Listing DSN`s in the system

D

DagL

Hello!

I have made a screen with code that allows users to link in tables for other
databases, using ODBC. I then use the DoCmd.TransferDatabase - to do this.
But, the program must know the name of the DSN to connect through. I have
made an entry field so the user can type in this name.

The problem is that most of the users don`t know the name, and does not
remember it more than one day. Therefore, I need to list the names of the
DSN`s that is registered at the computer.

Does anyone has some idea of a .dll / function to use for this?

Best regards
DagL
 
S

Stuart McCall

DagL said:
Hello!

I have made a screen with code that allows users to link in tables for
other
databases, using ODBC. I then use the DoCmd.TransferDatabase - to do this.
But, the program must know the name of the DSN to connect through. I have
made an entry field so the user can type in this name.

The problem is that most of the users don`t know the name, and does not
remember it more than one day. Therefore, I need to list the names of the
DSN`s that is registered at the computer.

Does anyone has some idea of a .dll / function to use for this?

Best regards
DagL

Try this:

http://www.smccall.demon.co.uk/MiscApi.htm#DsnListbox

Just what you're looking for, by the sound of it.
 
T

Tony Toews [MVP]

DagL said:
I have made a screen with code that allows users to link in tables for other
databases, using ODBC. I then use the DoCmd.TransferDatabase - to do this.
But, the program must know the name of the DSN to connect through. I have
made an entry field so the user can type in this name.

The problem is that most of the users don`t know the name, and does not
remember it more than one day. Therefore, I need to list the names of the
DSN`s that is registered at the computer.

Why not go DSN less?

I much prefer DSN-Less connections as it is one less thing for someone
to have to configure and one less thing for the users to screw up.
This is also better for Citrix/TS farms where each individual system
would have to have a DSN created and maintained.

Using DSN-Less Connections
http://www.accessmvp.com/djsteele/DSNLessLinks.html
ODBC DSN-Less Connection Tutorial Part I
http://www.amazecreations.com/datafast/GetFile.aspx?file=ODBCTutor01.htm&Article=true
HOWTO: Use "DSN-Less" ODBC Connections with RDO and DAO
http://support.microsoft.com/?id=147875
ODBC DSN Less
http://www.carlprothman.net/Default.aspx?tabid=81
Relink ODBC tables from code
http://www.mvps.org/access/tables/tbl0010.htm

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
D

DagL

Tony Toews said:
Why not go DSN less?
Tony

I have looked at this, but I need to use DSN. The ODBC driver that we use,
demand a DSN to set up paths to the data files (COBOL data files), security
and other settings. So I must use a DSN unfortunately.

Thanks for the tip anyway, maybe I can use it later on.

Regards DagL
 

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