Hello,
HELP!
I have TWO questions:
First, I am trying to execute a SQL pass-through query in Access VBA.
According to MSAccess help, I should be able to use the following
syntax after Creating an MSJet Workspace:
wrkJet.OpenData base("Publisher s", dbDriverComplet eRequired, True, _
"ODBC;DATABASE= pubs;DSN=Publis hers;")
where "Pulishers" should be the DSN name per Access help.
I have tried to establish a connection this way and get the message
"file not found (I used the code exaclty as below but instead of an
empty string I included the DSN name.)
I then tried using an empty string instead of a DSN name:
dim SQLWS as Workspace
dim SQLDB as Database
Set SQLWS = CreateWorkspace ("SQLWorkspace" , CurrentUser, "", dbUseJet)
Set sqlDB = SQLWS.OpenDatab ase("", & _
dbDriverNoPromp t, ,
"ODBC;DATABASE= Test_DMD;DSN=DM D")
This works, but I get prompted to select the DSN, even though I have
supplied the connection string.
MY FIRST QUESTION IS: How can I get the OPENDATABASE to work without
prompting me to supply the DSN each time if I want to open it up as
JET.
My second question is this:
I can open up an ODBC direct connection to the database using an ODBC
direct workspace and a connection object. Are there
drawbacks/disadvantages or advantages to doing so over a JET workspace
and SQLPassThrough?
Thanks,
Ryan