 |
|
 |
yronium Level: Moderator

 Registered: 14-04-2002 Posts: 912
|
Re: ADO Connection
Hello. In addition to stickleproject's tips, you got to ensure the connection is open, before attempting to retrieve records from the db. And there's no need to declare a local ADODB.Connection variable: you can simply specify the global connection to the recordset, and it will use it. But you GOT to specify the connection for the recordset to use to be open: ' assumes that the CurrentProject.Connection object is a valid and currently open connection
GdRs.Open SQLst, cnn1
' (If the connection is open, this also works, and it doesn't need any additional variable declaration)
' GdRs.Open SQLst, CurrentProject.Connection |
And more, you better should specify the cursor type:| GdRs.Open SQLst, cnn1, adOpenForwardOnly |
... and the lock type...| GdRs.Open SQLst, cnn1, adOpenForwardOnly, adLockReadOnly |
... and the type of request too, in order to speed up ADO's retrieval work| GdRs.Open SQLst, cnn1, adOpenForwardOnly, adLockReadOnly, adCmdText |
Well, in fact you better deepen ADO's usage. Maybe you would appreciate looking this sample project I posted time ago.
Hope it helps.
____________________________
Real Programmer can count up to 1024 on his fingers
|
|
21-11-2007 at 04:52 PM |
|
|
|
|
 |
 |