MS Access Record Search and Form Population

I've created a form for users to Search/Edit records they create.  I want to allow them to search for records using the Record ID, Sales Engineer, or Customer Name. I have the first option (ID SEarch) working using the first script below.  
The second script is one that I'm attempting to use to search for records using a text field, allowing the user to search by "Sales Engineer".  I have the form data source set to a Query 1 that list the Record ID, Sales Engineer and Customer.  I can't seem to get this search to work like the ID Serch.  Please let me know what I'm missing.
Thanks,
- Joe

Private Sub Command5_Click()
On Error GoTo Err_Command5_Click
        Screen.PreviousControl.SetFocus
    DoCmd.OpenForm "TSE Input Form", , , "[ID]=" & Text3.Text
    Exit_Command3_Click:
    Exit Sub
Err_Command3_Click:
    MsgBox Err.Description
    Resume Exit_Command5_Click
    End Sub
_____________________________________________________________________________________
Private Sub FindRecord_Click()
On Error GoTo Err_FindRecord_Click
 Screen.PreviousControl.SetFocus
DoCmd.OpenForm "TSE Input Form", , , "[Sales Engineer]="" & text0.Text & """
Exit_FindRecord_Click:
    Exit Sub
Err_FindRecord_Click:
    MsgBox Err.Description
    Resume Exit_FindRecord_Click
  End Sub
westbrjbAsked:
Who is Participating?
 
Rey Obrero (Capricorn1)Commented:
you were using

dq -- double quote
                              dq dq                  dqdqdq
"[Sales Engineer]=" " & text0.Text & " " "


should be
sq --single quote
                             sqdq            dqsqdq
"[Sales Engineer]=' " & text0 & " ' "
0
 
Rey Obrero (Capricorn1)Commented:
try this


DoCmd.OpenForm "TSE Input Form", , , "[Sales Engineer]='" & text0 & "'"
0
 
John Mc HaleForensic Computer Examiner, Analyst/Programmer & Database ArchitectCommented:
I like double-quotes in queries (it takes care of those data entry clerks that insist on entering names like O'Malley, O'Hara etc. Single quotes in this case would result in syntax errors!
0
 
Rey Obrero (Capricorn1)Commented:
if you type in a name  like O'hara then you should use
"[Sales Engineer]=" & chr(34) & text0 & chr(34)
0
 
John Mc HaleForensic Computer Examiner, Analyst/Programmer & Database ArchitectCommented:
my point exactly!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.