Using a variable value in an SQL statement

G

Guest

I'm trying to constuct an SQL statement in VBA code to create a table in a
separate database. I have stored the path and name of the destination
database in a variable. The code runs but the resultant query has the name of
the variable as the destination database rather than using the contents of
the variable. I have tried using various combinations of single and double
quotation marks and concatenation, but none works. Any ideas?

Roger
 
G

Guest

I've found the syntax:-

'" & VariableName & "'

I thought I'd tried this but I think I left out the spaces around the
ampersand.

Thanks for replying
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top