Easy VB question

szymek_d

Registered User.
Local time
Today, 14:35
Joined
May 26, 2005
Messages
21
Just quick and i think easy question
I'm building a query in VB:

strSQL = "SELECT f1, f2 & ", " & f3 as fullName" & _
" from t1"

so my problem is the quotetion marks around the comma between f2 and f3. So is there a way in VB to make VB treat only those quations around the comma as character?
Sorry about poor title but i had no idea how to refer to this issue.

Thank you!!
 
sz,

Change:

strSQL = "SELECT f1, f2 & ", " & f3 as fullName" & _
" from t1"

To:

strSQL = "SELECT f1, f2, f3 as fullName from t1"

Wayne
 
Thanks for the prompt reply

The only thing is I do want the comma to be in there, because later report gets generated based on that query and in this case I want to have comma between the first name and last name.

Is it even possible to keep that comma in there?
 
sz,

strSQL = "SELECT f1, f2 & ', ' & f3 as fullName from t1"

Note: VBA uses the " as delimiter, SQL uses '.

Wayne
 
Thank you very much Wayne!!!

It works now.

I was using " as delimiter in SQL. It works, but it started causing problems when i started generating quereis in VBA.
 

Users who are viewing this thread

Back
Top Bottom