Finding Multiple Records

G

Guest

I have an unbound text box I use to search for records. Works fine except
when multiple records of the same number are stored in the database. I need a
form that pops up showing the multiple records, allows me to select one, and
then finds the record selected. Any ideas on HOW TO DO?
 
J

John Vinson

I have an unbound text box I use to search for records. Works fine except
when multiple records of the same number are stored in the database. I need a
form that pops up showing the multiple records, allows me to select one, and
then finds the record selected. Any ideas on HOW TO DO?

Use a continuous Form bound on a query using the textbox as a
criterion; put a command button on the continuous form to open the
current record:

Private Sub cmdGo_Click()
Dim rs As DAO.Recordset
DoCmd.OpenForm "YourDisplayForm" ' if it's not open already
Set rs = Forms!YourDisplayForm.RecordsetClone
rs.FindFirst "[ID] = " & Me!ID
If rs.NoMatch Then
<handle the error condition>
Else
Forms!YourDisplayForm.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End Sub

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top