FindFirst and Apostrophe

M

Mark

I get "error 3077 Syntax Error (missing operator) in expression" in this
expression:
Rst.FindFirst "[Section]='" & Me!NewSection & "'"
when Me!NewSection contains an apostrophe.

How can I write the FindFirst expression so it works whether or not
Me!NewSection contains an apostrophe?

Thanks!

Mark
 
T

Trevor Best

Mark said:
I get "error 3077 Syntax Error (missing operator) in expression" in this
expression:
Rst.FindFirst "[Section]='" & Me!NewSection & "'"
when Me!NewSection contains an apostrophe.

How can I write the FindFirst expression so it works whether or not
Me!NewSection contains an apostrophe?

As others have said the double quote thing, that can bring about the
same problem if your text contains a double quote. The answer is to
double up your quotes, e.g.

Rst.FindFirst "[Section]='" & Replace(Me!NewSection,"'","''") & "'"
 
G

George

-----Original Message-----
I get "error 3077 Syntax Error (missing operator) in expression" in this
expression:
Rst.FindFirst "[Section]='" & Me!NewSection & "'"
when Me!NewSection contains an apostrophe.

How can I write the FindFirst expression so it works whether or not
Me!NewSection contains an apostrophe?

Thanks!

Mark


.


I used this successfully:

Rst.FindFirst "[Section]='" & Me![lbxList52]& "'"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Combo Box Error 3077 - Access 2003 1
Clone Code Complication 2
List Box Error 1
Missing Operator 5
Variable does not exist - but does? 2
Syntax Error 3
Code Issues 1
Recordset Findfirst Date Issue 0

Top