Here's how I parse a text box where the user can enter a
Last name and First name (separated by commas). You
should be able to use this as an example (i.e., instead of
looking for commas, look for "/" in the date text box.
Make sure you use an input mask so that you can anticipate
the input). If you use only one mask, you should be able
to just use the Mid command to get the information, rather
than look for "/".
Hope this helps, john
If Me.ctlLName = "" Then
MsgBox "You didn't enter a last name to find."
Else
blnComma = False
strFirstName = ""
For i = 1 To Len(Me.ctlLName)
If Mid(Me.ctlLName, i, 1) = "," Or blnComma Then
blnComma = True
If Mid(Me.ctlLName, i, 1) <> "," And Mid
(Me.ctlLName, i, 1) <> " " Then
strFirstName = strFirstName & Mid
(Me.ctlLName, i, 1)
End If
Else
If Mid(Me.ctlLName, i, 1) <> " " Then
strLastName = strLastName & Mid(Me.ctlLName, i, 1)
End If
Next i
If strFirstName = "" Then
strCriteria = "Lname = '" & Me.ctlLName & "'"
Else
strCriteria = "Lname = '" & strLastName & "' And
Fname = '" & strFirstName & "'"
End If
rst.FindFirst strCriteria
If rst.NoMatch Then
MsgBox "Couldn't find the last name " & Me.ctlLName
Else
Forms![frmDemographics].Bookmark = rst.Bookmark
End If
End If