473,399 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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
Nov 12 '05 #1
3 5632
Try:
Rst.FindFirst "[Section]=""" & Me!NewSection & """"
--
Duane Hookom
MS Access MVP
"Mark" <mm*****@Earthlink.net> wrote in message
news:Im*****************@newsread2.news.atl.earthl 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

Nov 12 '05 #2
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?

Thanks!

Mark


Don't use the apostraphe as your text delimiter, use the double quote
character:

Rst.FindFirst "[Section]=" & Chr(32) & Me!NewSection & Chr(32)

ps. Perhaps don't cross-post either! :)
--
regards,

Bradley
Nov 12 '05 #3
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
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mark | last post by:
I get "error 3077 Syntax Error (missing operator) in expression" in this expression: Rst.FindFirst "='" & Me!NewSection & "'" when Me!NewSection contains an apostrophe. How can I write the...
13
by: Richard Hollenbeck | last post by:
To prevent future apostrophe bugs and errors, isn't it just simpler to forbid an apostrophe from being entered into a text field? For example, couldn't "Alice's Restaurant" be changed to "Alices...
5
by: Paul | last post by:
The 2 statements below work perfectly when using them individually. But when I try to concatenate them, they don't. rst.FindFirst " = " & OldQuoteNumber rst.FindFirst " Is Null" Can someone...
6
by: Shyguy | last post by:
Is there a way to use this when entries have an apostrphe in them? Like Joe's Bar and Grill.
1
by: Rose | last post by:
Hi all, I'm trying to create a clickable link, but the pesky apostrophe is preventing the link from getting displayed properly. I'm displaying the contents of a folder (with contains the...
9
by: Thomas 'PointedEars' Lahn | last post by:
Jukka K. Korpela wrote: IBTD. For example, in English it is customary (and AIUI expected) to use the character that ’ represents should be used to delimit a quotation within direct speech...
25
by: Rick Collard | last post by:
Using DAO 3.6 on an Access 2002 database, I'm getting unexpected results with the FindFirst method. Here's the simple code to test: Public Sub FindIt() Dim db As Database, rs As Recordset...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.