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

VB String in VB SQL Query

100+
P: 365
Hello, i am trying to use VB strings in queries... with no luck... i can get VB integers to work but not strings

i have several situations i need this and at the moment i am having to use a dlookup to set the value of a text box or set the value as the string and use that in the query

for number it works (as im sure you know)...
Expand|Select|Wrap|Line Numbers
  1. mySQL = "SELECT something FROM somewhere WHERE something = " & VBNumber
so for string values i have tried the same..
as well as variations of single quotes and double quotes etc...

Can someone let me know where i am going wrong?

Thanks

Dan
Dec 18 '07 #1
Share this Question
Share on Google+
2 Replies


puppydogbuddy
Expert 100+
P: 1,923
Hello, i am trying to use VB strings in queries... with no luck... i can get VB integers to work but not strings

i have several situations i need this and at the moment i am having to use a dlookup to set the value of a text box or set the value as the string and use that in the query

for number it works (as im sure you know)...

mySQL = "SELECT something FROM somewhere WHERE something = " & VBNumber

so for string values i have tried the same..
as well as variations of single quotes and double quotes etc...

Can someone let me know where i am going wrong?

Thanks

Dan
Expand|Select|Wrap|Line Numbers
  1. mySQL = "SELECT something FROM somewhere WHERE something = '" & VBTextString & "'"
Dec 18 '07 #2

NeoPa
Expert Mod 15k+
P: 31,308

Post your reply

Sign in to post your reply or Sign up for a free account.