Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax error (missing operator) in expression 1

Status
Not open for further replies.

LISAANN

Technical User
Nov 28, 2001
12
US
I have set up a look-up field in my form that gives me the error message;(missing operator)in expression; whenever I try to pull up anything with an apostrophe. What the heck is up with that? I have pasted the code below, please, someone, tell me what I am missing.Thank you, thank you, and many thank you's to follow!

Lisa (so obviously NOT a programmer :) )

Option Compare Database

Private Sub Combo10_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Company] = '" & Me![Combo10] & "'"
Me.Bookmark = rs.Bookmark
End Sub

 
I think the apostrophe is creating unbalanced quotes. I don't know how to get around this problem other than creating another field (probably an autonumber field) for each record. Then use the new field as the lookup.
The user can still look at the list of names with apostrophes, but the database uses the numeric values to actually find the requested record.
 

You should be able to use two double quotes in the place of the one single quote. Access will convert the two double quotes to one double quote.

rs.FindFirst "[Company] = """ & Me![Combo10] & """" Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Thank you so much for your help. The double quotes worked like a charm! Thanks again!

Lisa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top