Im trying to create a search facility - I posted something like this before but i just couldnt figure it out! Now i know im pretty close but just one thing i wonder if you could help me with -
This is the code:
Dim szLastName As String, szCrit As String
'Retrieve the entered Search Criteria
szLastName = Nz(Me!txtSurname, "")
'Determine if the user entered criteria
If Len(szLastName) = 1 Then
MsgBox "You must first enter a Surname to search on."
Cancel = True
szCrit = BuildCriteria(txtSurname, dbText, szLastName)
'Apply the Filter to the form
DoCmd.ApplyFilter , szCrit
txtSurname.Value = ""
When i F8 it, the szCrit is picking up the value of the surname that i wish to search for but when i F8 past the Filter its bringing up a message box with the Title bar saying "Enter Parameter Values" and the surname is being displayed on the message box with a text box below it - Neone have any idea why its asking me for Parameters?!
What exactly is in your szCrit variable? What parameter value is indicated?
The problem is your szCrit string contains something that is not on the form or is not in the form's query. Here is a filter from my form: ((MasterFrmQy.StatusCd="I"))
Run you form.
Click in the field by which you want to filter.
Right click and choose Filter By Selection.
Design your form
In the property window, copy out the text in the Filter property.
Make your BuildCriteria function's return value look the same.