Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

including quotation marks in .sql string within vba?

Status
Not open for further replies.

misubud

IS-IT--Management
May 29, 2002
25
NZ
I have need to run a vba .sql query.
standard querys are ok, but anything like the below example, falls over, I presume due to the fact that the .sql
contains a null value i.e a "", and hence the app doesn't know when the.sql string has finished.
How do you include quotation marks("") within a text string?

strSQL = "SELECT transaction_num, po_num, po_date FROM blah where po_num =""
 
Hi,

Are you sure that you don't mean...
Code:
strSQL = "SELECT transaction_num, po_num, po_date  FROM blah where po_num ='' "
???

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Hi misubud,

If you want an empty string, then do as Skip says, but if you are really dealing with Nulls then you don't want quotes at all, but something like ..
Code:
[blue]strSQL = "SELECT transaction_num, po_num, po_date  FROM blah where IsNull(po_num)"[/blue]

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top