Log in

View Full Version : Search for record with combo box


Stuartjacks
Jul 25, 2010, 09:45 AM
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!

ScottGem
Aug 6, 2010, 09:23 AM
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;