L
LittlePenny
I've been trying to adapt Allen's code to create a search form. I had
success. However I would like to use "EQUALS" s instead of "LIKE" in
the line of code below. I just can get the syntax. Please help.
GCriteria = cboSearchField.value & " LIKE '*" & txtSearchString &
"*'"
Would like to use Equales
Full Code
Private Sub cmdSearch_Click()
If Len(cboSearchField) = 0 Or IsNull(cboSearchField) = True Then
MsgBox "You must select a field to search."
ElseIf Len(txtSearchString) = 0 Or IsNull(txtSearchString) = True
Then
MsgBox "You must enter a search string."
Else
'Generate search criteria
GCriteria = cboSearchField.value & " LIKE '*" &
txtSearchString & "*'"
'Filter frmCustomers based on search criteria
Form_frmRequest.RecordSource = "select * from tbl_Request
where " & GCriteria
Form_frmMonthEnd.Caption = "Request Form (" &
cboSearchField.value & " contains '*" & txtSearchString & "*')"
'Close frmSearch
DoCmd.Close acForm, "frmRequestSearch"
MsgBox "Results have been filtered."
End If
End Sub
Little Penny
success. However I would like to use "EQUALS" s instead of "LIKE" in
the line of code below. I just can get the syntax. Please help.
GCriteria = cboSearchField.value & " LIKE '*" & txtSearchString &
"*'"
Would like to use Equales
Full Code
Private Sub cmdSearch_Click()
If Len(cboSearchField) = 0 Or IsNull(cboSearchField) = True Then
MsgBox "You must select a field to search."
ElseIf Len(txtSearchString) = 0 Or IsNull(txtSearchString) = True
Then
MsgBox "You must enter a search string."
Else
'Generate search criteria
GCriteria = cboSearchField.value & " LIKE '*" &
txtSearchString & "*'"
'Filter frmCustomers based on search criteria
Form_frmRequest.RecordSource = "select * from tbl_Request
where " & GCriteria
Form_frmMonthEnd.Caption = "Request Form (" &
cboSearchField.value & " contains '*" & txtSearchString & "*')"
'Close frmSearch
DoCmd.Close acForm, "frmRequestSearch"
MsgBox "Results have been filtered."
End If
End Sub
Little Penny