Can anyone help me with (or point me to an example) creating a search page with unbound textboxs. What I need to be able to do is select a checkbox to include or not to include the textbox in the search.
For example: I have physical descriptors in my table such as "Race", "Age", ect. I need to be able to selcect which descriptors to search by and then be able to type in a textbox what to search for. I want the results to show a list of names of people who fit that description.
Thanks.
-Phil
Private Sub Clear_Click()
txtFilter = vbNullString
lstResults.RowSource = ""
End Sub
Private Sub cmdSearch_Click()
If IsNull(Me.txtFilter) Then
MsgBox "You have not entered any Name to Search.", vbExclamation, "Title"
Exit Sub
End If
With lstResults
.RowSource = "SELECT [Booking Sheet Number], [Last], [First], [Race], FROM BookingSheet WHERE [Race]Like '*" & Me.txtFilter & "*';"
.RowSource = "SELECT [Booking Sheet Number], [Last], [First], [Sex], FROM BookingSheet WHERE [Sex]Like '*" & Me.txtFilter & "*';"
.Requery
End With
End Sub
Private Sub lstResults_AfterUpdate()
DoCmd.OpenForm "BookingSheet", RecordSource = "BookingSheet", acNormal, "[Booking Sheet Number] = " & lstResults.Column(0)
End Sub
For example: I have physical descriptors in my table such as "Race", "Age", ect. I need to be able to selcect which descriptors to search by and then be able to type in a textbox what to search for. I want the results to show a list of names of people who fit that description.
Thanks.
-Phil
Private Sub Clear_Click()
txtFilter = vbNullString
lstResults.RowSource = ""
End Sub
Private Sub cmdSearch_Click()
If IsNull(Me.txtFilter) Then
MsgBox "You have not entered any Name to Search.", vbExclamation, "Title"
Exit Sub
End If
With lstResults
.RowSource = "SELECT [Booking Sheet Number], [Last], [First], [Race], FROM BookingSheet WHERE [Race]Like '*" & Me.txtFilter & "*';"
.RowSource = "SELECT [Booking Sheet Number], [Last], [First], [Sex], FROM BookingSheet WHERE [Sex]Like '*" & Me.txtFilter & "*';"
.Requery
End With
End Sub
Private Sub lstResults_AfterUpdate()
DoCmd.OpenForm "BookingSheet", RecordSource = "BookingSheet", acNormal, "[Booking Sheet Number] = " & lstResults.Column(0)
End Sub
Last edited: