L
lostandconfused
I have a form with a text box and a command button. When the user types in a
last name and uses the command button it shows the results in a subform. I
would also like the user to be able to put in a last name or a drivers
license number and the seach button would find it. What would I add to my
code to include searching for field DLNumber. Heres is the code I am using.
Ive tried just duplicating from If Len to Boland=true but I end up with no
results. Is this because I am searching for a number and not text if so how
could I do this. Thanks
Dim strFilter As String
Dim bolAnd As Boolean
bolAnd = False
strFilter = ""
If Len(Me.Text0.Value) > 0 Then
If bolAnd Then
strFilter = strFilter & " and "
End If
strFilter = strFilter & " LastName Like '*" & Me.Text0.Value & "*'"
bolAnd = True
End If
With Me.[MN_Person1].Form
If .Dirty Then
.Dirty = False
End If
If strFilter = "" Then
.FilterOn = False 'Nothing entered: show all records.
Else
.Filter = strFilter
.FilterOn = True
End If
End With
last name and uses the command button it shows the results in a subform. I
would also like the user to be able to put in a last name or a drivers
license number and the seach button would find it. What would I add to my
code to include searching for field DLNumber. Heres is the code I am using.
Ive tried just duplicating from If Len to Boland=true but I end up with no
results. Is this because I am searching for a number and not text if so how
could I do this. Thanks
Dim strFilter As String
Dim bolAnd As Boolean
bolAnd = False
strFilter = ""
If Len(Me.Text0.Value) > 0 Then
If bolAnd Then
strFilter = strFilter & " and "
End If
strFilter = strFilter & " LastName Like '*" & Me.Text0.Value & "*'"
bolAnd = True
End If
With Me.[MN_Person1].Form
If .Dirty Then
.Dirty = False
End If
If strFilter = "" Then
.FilterOn = False 'Nothing entered: show all records.
Else
.Filter = strFilter
.FilterOn = True
End If
End With