By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,510 Members | 1,504 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,510 IT Pros & Developers. It's quick & easy.

Dealing With Quotes In SQL Statement

P: n/a
This is probably simple but:

The following portion of an SQL statement that I've copied from the SQL
view of the query grid (the query works fine) is giving me an error to
the effect that it is expecting an "end of statement" after the first
quotation mark before the word "Fail". From my very limited knowledge
of SQL, I'm assuming that it sees the first quotation mark as the end
of the statement. How can I remedy this?

strSQL = strSQL & " WHERE (((Data.Name) =
[Forms]![HistoryQInput]![TxtName]) And ((Data.DeviceNo) =
[Forms]![HistoryQInput]![TxtDeviceNo]) And ((Data.Result) = "Fail")) Or
(((Data.Name) = [Forms]![HistoryQInput]![TxtName]) And ((Data.DeviceNo)
= [Forms]![HistoryQInput]![TxtDeviceNo]) And ((Data.ResultAlc) =
"Fail"))"

Any help would be appreciated.

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Use single quotes around both Fails instead of double quotes.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"Wayne" <cq*******@volcanomail.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
This is probably simple but:

The following portion of an SQL statement that I've copied from the SQL
view of the query grid (the query works fine) is giving me an error to
the effect that it is expecting an "end of statement" after the first
quotation mark before the word "Fail". From my very limited knowledge
of SQL, I'm assuming that it sees the first quotation mark as the end
of the statement. How can I remedy this?

strSQL = strSQL & " WHERE (((Data.Name) =
[Forms]![HistoryQInput]![TxtName]) And ((Data.DeviceNo) =
[Forms]![HistoryQInput]![TxtDeviceNo]) And ((Data.Result) = "Fail")) Or
(((Data.Name) = [Forms]![HistoryQInput]![TxtName]) And ((Data.DeviceNo)
= [Forms]![HistoryQInput]![TxtDeviceNo]) And ((Data.ResultAlc) =
"Fail"))"

Any help would be appreciated.

Nov 13 '05 #2

P: n/a
Thanks for the help.

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.