ADO Connection and Recordset code

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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
 
Back
Top