ScrmingWhisprs
I <3 Coffee Milk.
- Local time
- Today, 14:33
- Joined
- Jun 29, 2006
- Messages
- 156
Hey there.
I have a search form where users can search for workers. The results are displayed in a listbox. From there, the user can double click on a name to open that worker's record. What I would like to happen is if there is only 1 result (a perfect match) I would like the worker's record to automatically open up. Here is my code:
The problem I'm having is it can't open the form because that record is not actually selected in the listbox. How would I go about automatically making the selection to the 1 record in the listbox?
Thanks
SW
I have a search form where users can search for workers. The results are displayed in a listbox. From there, the user can double click on a name to open that worker's record. What I would like to happen is if there is only 1 result (a perfect match) I would like the worker's record to automatically open up. Here is my code:
Code:
Private Sub cmdSearch_Click()
Me.lboResults.Requery
If Me.lboResults.ListCount = 1 Then
Me.lboResults.SetFocus
DoCmd.OpenForm "frmWorkers", acNormal, , "[vID] = " & Me.lboResults
End If
End Sub
The problem I'm having is it can't open the form because that record is not actually selected in the listbox. How would I go about automatically making the selection to the 1 record in the listbox?
Thanks
SW