473,396 Members | 2,004 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,396 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 5631
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.