Hi,

I have a form where the user can enter in a surname into an unbound textbox and press return (or click ok) and the records which have that surname will be returned. I have used this a number of times but the last time I used it every time I typed in a surname into the textbox - a parameter box appeared asking me to enter a value - once i did all of the records would disappear. Can anyone tell me why the BuildCriteria method is acting strange - it produces [murray] rather than surname = "murray". This problem is only occurring in one dB - it works everywhere else.
Has anyone come across this before?!

the code for the textbox is:

Private Sub LASTNAME1_Exit(Cancel As Integer)
Dim szLastName As String, szCrit As String
szLastName = Nz(Me!LASTNAME1, "")
If Len(szLastName) < 1 Then
MsgBox "you must first enter a last name to search on."
Cancel = True
Else
szCrit = BuildCriteria("Customer_Last_Name", dbText, szLastName)
DoCmd.ApplyFilter , szCrit
End If
LASTNAME1.Value = ""
Customer_Last_Name.SetFocus
End Sub

C.