By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,247 Members | 1,989 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,247 IT Pros & Developers. It's quick & easy.

Open an ODBC connection in a jet workspace and which workspace is better

P: n/a

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.OpenDatabase("Publishers", dbDriverCompleteRequired, True, _

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.OpenDatabase("", & _
dbDriverNoPrompt, ,

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

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?

Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.