I just want to allow users to find a record based on what they type into a text box on my search form. The data control is on my main form. All attempts to use different combinations of code fail. I am out of Advil & patience!!! Please look at this code and advise.

RK


Private Sub cmdOK_Click()

If Trim(txtFind) = "" Then Exit Sub

Dim SQL As String
Dim Name2Find As String

Name2Find = Trim(txtFind.Text)

SQL = "SELECT From Customers WHERE LastName Like '%" & txtFind.Text & "%'"

With frmMain.Data1
.RecordSource = SQL
.Refresh
End With

Unload Me

End Sub