DSN-less connection

  • Thread starter Thread starter Ezekiël
  • Start date Start date
E

Ezekiël

Hello erverybody,

Can someone tell me what the best way is to use a dsn-less connection code.
Should i use it in a form or use it in a module?

Greetings,
Ezekiël
 
HI,

The best way I have found is to create a .udl file that sits in a shared
folder and points to your data source (any OLEDB provider)
In a class you use "File Name=F:\MyUDL.udl" in the connection.Open command.

Now you keep and use that connection object for all your code.

The beauty of this system is that all users point to this location (provide
a browse capability to find it) and when you move from a test db to your
production db then double-click the .udl file to open it and change the
database. Automatically every user from then on will be pointed to the new
database - seamlessly.

To make the udl file work with an Access Project see article: 305388 in
Microsoft's knowledgebase. There are links to more good articles at the
bottom of this one.

--
Rod Gill
Project MVP
For Microsoft Project companion projects, best practices and Project VBA
development services
visit www.projectlearning.com/
 
I have some difficulties to understand your question.

DSN are for ODBC connections; they are useless for true OLEDB connection,
with the exception of the OLEDB connector for ODBC. When you are using ADP,
you are generally using OLEDB for SQL-Server, so there is no DSN involved.

Of course, you may be talking about making your own recordset for your forms
or manipulating directly a database via OLEDB or ODBC in VBA code but then,
the decision of using code behind a form or code in a module is more a
question of taste than of performance.

S. L.
 
Back
Top