Click to See Complete Forum and Search --> : How do I connect to a database who's pathname is supplied in a Microsoft Driver DSN?????????


February 4th, 2000, 08:05 AM
Does anyone know how to connect, using Visual Basic code, to a Microsoft Access database, who's pathname is supplied in a DSN?? The DSN is setup as follows:

It is a SYSTEM DSN, which uses the Microsoft Access Driver.
In the ODBC Microsoft Access Setup window, I want to access the full pathname listed in the Database section.

What connect string do I use in MS Access '97 using Visual Basic???

Johnny101
February 4th, 2000, 11:36 AM
Since the database has a dsn, you can use that. But you would be using ODBC instead of OLE DB. But here is how you can use the pre-existing DSN:

Sub Form_Load()
Dim cn as ADODB.Connection
Dim s as string

s = "DSN=YourDSN"

set cn = new ADODB.Connection

cn.Open s

msgbox "It Worked"

End Sub




If this isn't what you're asking, can you please expand your quesion?

Hope this helps,
John

John Pirkey
MCSD
www.ShallowWaterSystems.com