J
Joseph Ellis
Hello all,
I'm just now learning a little VBA, and would like to spruce up my
church database form's "search engine". Currently I have a list box
that lists fields in which the user can search, ie "Last Name", "First
Name", etc. Then the user can type the text they are looking for in a
text box, and jump to the first match:
Private Sub tboSearchText_AfterUpdate()
Dim sf As String
'Match user friendly strings to actual field names
If lboSearchField = "Last Name" Then
sf = "lastName"
ElseIf lboSearchField = "First Name" Then
sf = "firstName"
Else
sf = "zip"
End If
DoCmd.GoToControl sf
DoCmd.FindRecord tboSearchText, acAnywhere
'Clear the Search box
Me.tboSearchText.Value = ""
End Sub
What I'd like to do is pop up a continuous form (say, frmResults)
containing all the search results (ie all records with a Last Name of
"Smith"), allow the user to select the desired record, then close that
popup form and have the first form display the selected record.
Does that make sense? I'm open to suggestions if this approach is
horribly inefficient or inelegant.
Thanks,
Joseph
I'm just now learning a little VBA, and would like to spruce up my
church database form's "search engine". Currently I have a list box
that lists fields in which the user can search, ie "Last Name", "First
Name", etc. Then the user can type the text they are looking for in a
text box, and jump to the first match:
Private Sub tboSearchText_AfterUpdate()
Dim sf As String
'Match user friendly strings to actual field names
If lboSearchField = "Last Name" Then
sf = "lastName"
ElseIf lboSearchField = "First Name" Then
sf = "firstName"
Else
sf = "zip"
End If
DoCmd.GoToControl sf
DoCmd.FindRecord tboSearchText, acAnywhere
'Clear the Search box
Me.tboSearchText.Value = ""
End Sub
What I'd like to do is pop up a continuous form (say, frmResults)
containing all the search results (ie all records with a Last Name of
"Smith"), allow the user to select the desired record, then close that
popup form and have the first form display the selected record.
Does that make sense? I'm open to suggestions if this approach is
horribly inefficient or inelegant.
Thanks,
Joseph