Discussion Locked

Access 97 Combo Boxes

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a form with names, addresses and ID Numbers. I created a Combo Box using the wizard to search for the Fullname (Lastname, Firstname). Here is the code that was written:

Sub Combo21_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[FullName] = '" & Me![Combo21] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark

End Sub

It seemed to work until I found a member Smith, John where there were 4 Smith, John 's. Of course each has a unique ID Number.

The Combo Box lists ALL 4 Smith, John 's but when you click on any of the 4, it ALWAYS finds the FIRST as the code says. I don't want any navigation boxes to move from record to record.

Anyone have a fix for this?????

Thanks
Alan

3 replies

by bob sellman

Since your code says FindFirst, it will of course always find the first match.

Your problem is that you have not uniquely identified each John Smith. While I don't know how you would enable a user to tell who is the John Smith he is interested in, what you do need to do is include the ID number in your combo box table source. If you don't want to show the ID number, set the display width of the ID number column to 0". But you should have the ID selected as the valued of the combo box. Oryou can refer to it using the column property of the combo box, remembering that the first column is column 0.

Then for your findfirst statement, find the first record where the ID matches.

Your only problem will be to set up the combo box to include something that will enable the user to separately identify each John Smith.

by mra2

Thanks! Did the trick well.... I've used this kind of routine numerous times but never ran in a situation with the SAME EXACT NAMES...

Thanks Again..... Alan

This discussion is closed to new replies.