Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Access (https://www.askmehelpdesk.com/forumdisplay.php?f=441)
-   -   Search for record with combo box (https://www.askmehelpdesk.com/showthread.php?t=491682)

  • Jul 25, 2010, 09:45 AM
    Stuartjacks
    Search for record with combo box
    I have a combo box on a form that shows Surname and first Name fields in 2 columns.
    in my after update I have the following

    DoCmd.ShowAllRecords
    Me!Surname.SetFocus
    DoCmd.FindRecord Me!CboFindSurname
    'Set value of combo box equal to an empty string
    Me!CboFindSurname.Value = ""

    This works fine until I have more than one Identical surname then this only shows the record with the first ID number despite selecting a different Surname & First Name combination in the combo box.

    My query has ID (not shown), Surname (Ascending & Visible) and First name (ascending & Visible) - all drawn from the sme table if this helps at all

    I be grateful for any help anyone might be able to give as I've only just started on access and my abilities are very limited. - THANKS!
  • Aug 6, 2010, 09:23 AM
    ScottGem
    Use the Combobox wizard to create a search combo. You will need to edit the RowSource and to show both Surname and firstname. For people searches I use a RowSource like:

    SELECT PersonID, Surname & ", " & Firstname As Fullname
    FROM tablename
    ORDEr BY Surname, Firstname;

  • All times are GMT -7. The time now is 07:55 PM.