473,320 Members | 1,900 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,320 software developers and data experts.

Dealing With Quotes In SQL Statement

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
2 1901
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
Thanks for the help.

Nov 13 '05 #3

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

Similar topics

1
by: billmiami2 | last post by:
I'm trying to pass through a SQL statement to an Oracle database using OPENROWSET. My problem is that I'm not sure of the exact syntax I need to use when the SQL statement itself contains single...
5
by: Joel | last post by:
Hi, I incorporated a function in my code that whenever I use a string variable in an sql statement if the string contains a single quote it will encase it in double quotes else single quotes. ...
3
by: Stefania Scott | last post by:
How do I resolve the problem of passing a string that has quotes within in a SQL statement? Sometimes the string contains a single quote (') and some others it contains the double quote (")? Any...
24
by: deko | last post by:
I'm trying to log error messages and sometimes (no telling when or where) the message contains a string with double quotes. Is there a way get the query to insert the string with the double...
2
by: Jesse | last post by:
Whenever I write a line of code that uses quotation marks, such as.. <% foreach (merri.Data.dsMerri.AlbumDetailsRow dr in merri.Business.AllBusiness.ArtistAndAlbumByStyle("Children")) {%> I...
2
by: barry.edmund.wright | last post by:
Hi All, I want to build a Find Statement on the fly. The code below starting with 'This Code Works! is fine but as I said I want to build the Me!cboSelect1 & "=" & rs(Me!cboSelect1) portion of...
6
by: Yas | last post by:
Hello, Suppose I have the following table... name employeeId email -------------------------------------------- Tom 12345 tom@localhost.com Hary 54321 Hary 54321 hary@localhost.com
2
by: ncsthbell | last post by:
I am trying to construct a 'Copy' statement in Access 2000 vb that I will actually write out to create a .bat file. My problem is that I need to put quotes around the vcFileFrom and vcFileTo...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.