Hi all, looking at the code below, i enter a string in "BDAY" textbox and hit search. If will find all records with part of the string in the CARD column. How do i modify it to find an exact string match. thanks
Dim strWhere As String 'The criteria string.
Dim lngLen As Long 'Length of the criteria string to append to.
If Not IsNull(Me.brake) Then
strWhere = strWhere & "([CARD] Like ""*" & Me.BDAY & "*"") AND "
End If
'Chop off the trailing " AND ", and use the string as the form's Filter.
'If the string has more than 5 characters (a trailng " AND ") to remove.
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then 'Nah: there was nothing in the string.
MsgBox "No criteria", vbInformation, "Nothing to do."
Else 'Yep: there is something there, so remove the " AND " at the end.
strWhere = Left$(strWhere, lngLen)
'Apply the string as the form's Filter.
Me.Filter = strWhere
Me.FilterOn = True
End If
Dim strWhere As String 'The criteria string.
Dim lngLen As Long 'Length of the criteria string to append to.
If Not IsNull(Me.brake) Then
strWhere = strWhere & "([CARD] Like ""*" & Me.BDAY & "*"") AND "
End If
'Chop off the trailing " AND ", and use the string as the form's Filter.
'If the string has more than 5 characters (a trailng " AND ") to remove.
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then 'Nah: there was nothing in the string.
MsgBox "No criteria", vbInformation, "Nothing to do."
Else 'Yep: there is something there, so remove the " AND " at the end.
strWhere = Left$(strWhere, lngLen)
'Apply the string as the form's Filter.
Me.Filter = strWhere
Me.FilterOn = True
End If