ado connections

J

Jason

Hi,

Where should i place the following ado-connection info if i want to call it
from every form i create.
For testing purposes i used the code in the form's module and it worked.

Here is the code:

Dim cnn As ADODB.Connection

Set cnn = New ADODB.Connection

With cnn
.Provider = "sqloledb"
.Properties("Data Source") = "local"
.Properties("Initial Catalog") = "NEW"
.Properties("User ID") = "sa"
.Properties("Password") = "password"
End With
 
J

Jason

Hi,

I did what you suggested. But how can i call it from another form if i want
to use the current connection? Is this also the way to use connection
pooling or am i confused?

Thnx
 
R

RSusanto

I just realize if you use the SQL server, you can connect to the database
using ADP project in Access.
So you dont have to use this connection string anymore.
you just need 1 statement:

put it at the general modules
dim cn as new adodb.connection

public sub Set_Cn
set cn = currentproject.connection
end sub

then call it whenever you need it.
 

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