Do I have the right DSN for a linked table?

D

Dennis

Here's the situation (Access 2002). Many of my agency's applications use
linked tables (to SQL tables). Is there a way that I can "test" to see, table
by table, whether or not a user has the correct DSN/ODBC connection(s) to
access the table(s)?

What I want to do is spin through each table, checking to see if it's
accessible. If not, I want to generate a MsgBox, saying something like:

"You do not currently have the correct DSN setup for table 'myTable'. Please
contact the Helpdesk for assistance."

I'd rather do that than have to trap an error in a critical routine
somewhere else in the application. I can run this module right at startup,
and let a (new?) user know that they need something setup before they can run
the application.

Any ideas would be MOST appreciated.

Thanks!!
 
D

Douglas J Steele

Look at the Connect property of the table. The DSN name will be contained as
part of it.
 
D

Dennis

Okay. But how do I *use* that? I understand that I can view the DSN name, but
how do I check to see if the user has that one defined on his PC?
 
D

Douglas J Steele

Sorry, I thought you were wanting to check that they were linked using the
correct DSN.

DSN information is simply stored in the registry.

User DSNs are under HKCU\Software\ODBC, System DSNs are under
HKLM\Software\ODBC

Grab code that can read the registry (like, for instance,
http://www.mvps.org/access/api/api0015.htm at "The Access Web") and check
whether the necessary key(s) exist.
 
D

Dennis

I'll look into this. Thanks for the info!

Douglas J Steele said:
Sorry, I thought you were wanting to check that they were linked using the
correct DSN.

DSN information is simply stored in the registry.

User DSNs are under HKCU\Software\ODBC, System DSNs are under
HKLM\Software\ODBC

Grab code that can read the registry (like, for instance,
http://www.mvps.org/access/api/api0015.htm at "The Access Web") and check
whether the necessary key(s) exist.
 

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

Top