ADO Connection and Recordset code

G

Guest

I am using ADO code to create a data connection and then to create recordset
objects. My question is ... Do I actually need to create a connection to the
current database project before declaring and creating the recordset object.
My form seems to work fine without the connection code but with it I
sometimes get an error relating to the database being inaccessible.
 
G

Guest

No need to to create a connection before declaring etc. My own usual style
is something like:

Dim rst as ADODB.Recordset
Set rst = New ADODB.Recordset
rst.Open "SELECT * FROM tblSomeTable", _
CurrentProject.Connection, _
adOpenKeySet, _
adLockOptimistic

TomU
 

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