SanBaLao
01-29-2001, 07:18 AM
i have a form that i could enter a name to search for records in another form, it would work only if i typed in the exact full name in the textbox, but i would like to be able to just enter the first name or middle name and still be able to find relevant records.
Fornatian
01-29-2001, 07:38 AM
You need to look into the use of the LIKE operator, which will allow you to say give me all names that are LIKE Smith or LIKE James. It is quite easy to use. Instead of putting in the filter or query
Forms!MyForm![ControlName]
put
LIKE "*" & Forms!MyForm![ControlName] & "*"
should work like a charm.
Ian
SanBaLao
01-30-2001, 06:08 AM
here's another one , if a user were to enter a name which does not exist in the records, an empty form would be opened. could i have a error msg to prompt the user that the name does not exist ?
Fornatian
01-30-2001, 07:44 AM
Try something along the lines of this in the OnOpen event.
If Me.RecordsetClone.RecordCount <1 then
Msgbox "No records were found matching your criteria, close the form or enter a new record..",0,"Application Title"
End if
SanBaLao
02-01-2001, 03:20 AM
thanks , that worked just fine