A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

FindFirst and Apostrophe



 
 
Thread Tools Display Modes
  #1  
Old May 4th, 2004, 02:30 AM
Mark
external usenet poster
 
Posts: n/a
Default FindFirst and Apostrophe

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


  #2  
Old May 4th, 2004, 02:33 AM
Duane Hookom
external usenet poster
 
Posts: n/a
Default FindFirst and Apostrophe

Try:
Rst.FindFirst "[Section]=""" & Me!NewSection & """"


--
Duane Hookom
MS Access MVP


"Mark" wrote in message
ink.net...
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




  #3  
Old May 4th, 2004, 07:17 PM
Trevor Best
external usenet poster
 
Posts: n/a
Default FindFirst and Apostrophe

Mark wrote:
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,"'","''") & "'"

--
Error reading sig - A)bort R)etry I)nfluence with large hammer
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:03 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.