Re: Error in setting recordset object in option explicit

alicejwz

Registered User.
Local time
Today, 08:37
Joined
Jul 9, 2003
Messages
91
Re: Error in setting recordset object in option explicit

Hi all,

I like to set form's recordset visible throughout the form. I declared the variable and set the recordset object in option explicit but is giving me the error below-
Vb
Compile error:
Invalid outside procedure

Option Explicit
Public rs As New ADODB.Recordset
Public rsclone As New ADODB.Recordset

Error --> Set rst = Me.Recordset
Set rsclone = Me.RecordsetClone

Can someone help me w/ this? Thanks!
 
The errormessage seems to relate to doing the assigning outside a sub or function, it must be done within a sub or function.

Form recordsets can only be ADO if explicitly set to ADO, as in assigning an ADO recordset to the form recordset, or if you're working with an ADP. Else the form recordset, as Pat Hartman states, are DAO in all versions.
 
Re: Error in setting recordset object in option explicit

Thanks Roy & Pat for the info.
I think I figured it out. Thanks!
 

Users who are viewing this thread

Back
Top Bottom