dbTalk Databases Forums  

Dealing With Quotes In SQL Statement

comp.databases.ms-access comp.databases.ms-access


Discuss Dealing With Quotes In SQL Statement in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Wayne
 
Posts: n/a

Default Dealing With Quotes In SQL Statement - 01-03-2005 , 02:46 PM






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.


Reply With Quote
  #2  
Old   
PC Datasheet
 
Posts: n/a

Default Re: Dealing With Quotes In SQL Statement - 01-03-2005 , 02:50 PM






Use single quotes around both Fails instead of double quotes.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
resource (AT) pcdatasheet (DOT) com
www.pcdatasheet.com


"Wayne" <cqdigital (AT) volcanomail (DOT) com> wrote

Quote:
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.




Reply With Quote
  #3  
Old   
Wayne
 
Posts: n/a

Default Re: Dealing With Quotes In SQL Statement - 01-04-2005 , 04:19 AM



Thanks for the help.


Reply With Quote
Reply




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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.