Using a variable value in an SQL statement

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
Back
Top