VBA SQL - variable Source Data...

  • Thread starter Thread starter SpeeD
  • Start date Start date
S

SpeeD

Hi.

I'm new a this Excel/Sql thing. so bare with me :-)

My my problem is that i need to add several different (variable) SQL queries
to my WB so i´ve add the following with no success:

Cam = ActiveWorkbook.Path & "\" & "JB.xls"
...
..Connection = Array("OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;User
ID=Admin;Data Source=CAM;Mode=Share De"

it only works if i specify the complete path, not variable
..Connection = Array("OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;User
ID=Admin;Data Source=D:\TRABALHOS\2010\Março\JB.xls;Mode=Share De"

How can a make my variable with the Path work?

Thanks for reading this

SpeeD
 
..Connection = Array("OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;User
ID=Admin;Data Source=" & CAM & ";Mode=Share De"
 
Thanks a lot Bob!
It works! :-)

SpeeD

Bob Phillips said:
..Connection = Array("OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;User
ID=Admin;Data Source=" & CAM & ";Mode=Share De"

--

HTH

Bob




.
 
Back
Top