In some previous posts I was inquiring about record set order, thanks everyone for the help it fixed the problem. With that step out of the way I am having an problem with the next step.
So I search the DB for John Doe, and I get three results and have them listed in a Listbox:
Now I want to click an entry and have that John Doe's record show up.
My code has a lot of comments because I have been playing around. It "worked" when I used lstSearchResult s.ItemData.Item (1). But this only retrieved the first item from the list. I have, as you can see from my code tried to use lstSearchResult s.ItemSelected but the rest is still gray for me.
Anybody follow and can help? Please let me know.
Thank you.
So I search the DB for John Doe, and I get three results and have them listed in a Listbox:
Code:
ID First Name Last Name 4 John Doe 23 John Doe 58 John Doe
Code:
Private Sub lstSearchResults_Click() Dim dbs As DAO.Database Dim qdf As DAO.QueryDef Dim ci As String Dim ctl As Control Set dbs = CurrentDb Set ctl = lstSearchResults 'ci = ctl.ItemsSelected.Item(1) lstSearchResults.AddItem (ci) 'Dim strSQL As String 'strSQL = "Select * FROM Request WHERE Customer_Order_Number = " & lstSearchResults.ItemsSelected.Item(1) 'lstSearchResults.ItemData(1) 'Set qdf = dbs.CreateQueryDef("GetRequest", strSQL) DoCmd.OpenForm ("Current_Customer_Data") End Sub
Anybody follow and can help? Please let me know.
Thank you.
Comment