ADO vs DAO How to get the dialog to add/select ODBC DSN Connect in

L

Larry Novreske

What is the equivalent ADO code to open the ODBC dialog which allows a user
to select or create and then select the DSN of an ODBC data source.

In earlier versions of Access, using DAO the following code is used.

public function fnGetODBCConnect () as string
Dim wrkODBC As Workspace
Dim conPubs As Connection

Set wrkODBC = CreateWorkspace("NewODBCWorkspace", "admin", "", dbUseODBC)

Set conPubs = wrkODBC.OpenConnection("Connection", dbDriverPrompt, True,
"ODBC;DSN=MyDSN;")

fnGetODBCConnect = conPubs.Connect
Exit Function

Which would open up the ODBC dialog for creating/selecting a DSN and allow
me to get the connect string to an ODBC data source.

In all of the examples of ADO connections, all they show is keying in the
connect string which is not what I need.
 
T

Tony Toews [MVP]

Larry Novreske said:
What is the equivalent ADO code to open the ODBC dialog which allows a user
to select or create and then select the DSN of an ODBC data source.

No idea. However we suggest using a DSN less approach if at all
possible.

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/
 

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