Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Access Database - Search box  (Read 4025 times)

0 Members and 1 Guest are viewing this topic.

catz

    Topic Starter


    Rookie
  • I love YaBB 1G - SP1!
    Access Database - Search box
    « on: August 25, 2008, 04:43:51 PM »
    In an Access database, I have a form that, after the user performs a search,  displays the name of an employee, the parking tag #(s) that have been assigned to them and their phone extension. I'm using a search box (a combo box) on that form where the user can search using the Tag # to get the results mentioned above. A query showing all the employees and their related Parking Tag numbers is the data source used in the combo box. The combo box also has the following code in an After Update event procedure:

     Sub Combo3_AfterUpdate()
        ' Find the record that matches the control.
        Me.RecordsetClone.FindFirst "[TagInventory#] = '" & Me![Combo3] & "'"
        Me.Bookmark = Me.RecordsetClone.Bookmark
    End Sub]


    This works well when the user searches by the Tag number. 

    I'm trying to create a similar search box on another form but in this case the user can search by name.  The above code doesn't work where an employee has 2 Parking Tags assigned to them.  How do I adapt the code or what other procedure can I use so that all the records are displayed when an employee has more than 1 Tag# assigned to them. What can be used in place of FindFirst or FindLast?

    As always, thanks in advance for any assistance

    Sidewinder



      Guru

      Thanked: 139
    • Experience: Familiar
    • OS: Windows 10
    Re: Access Database - Search box
    « Reply #1 on: August 26, 2008, 04:14:22 PM »
    So this table is unique by tag number and a person can have multiple tags. Can you not run a query against the persons name?

    Another approach would be to use FindFirst, to get the first match, then use repetitive FindNext until the NoMatch property is true.

    Good luck.  8)
    The true sign of intelligence is not knowledge but imagination.

    -- Albert Einstein