VBA SQL - variable Source Data...

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
 
B

Bob Phillips

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

SpeeD

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




.
 

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

Similar Threads


Top