P
PJFry
I have been developing a database that uses recordsets at various point. I
declare the recordset variables that I use like so:
Public cn As ADODB.Connection
Public rst As ADODB.Recordset
Public strSQL As String
Then, in a given form, I will use the rst like so:
Private Sub Form_Load()
Set rst = New ADODB.Recordset
Set cn = CurrentProject.Connection
strSQL = "SELECT * FROM tSomething"
rst.open strSQL, cn, adOpenStatic, adLockOptimistic
If rst!lngULevel Then
Do This
Else
Do That
End if
End Sub
Then I may use the exact same set up with a different if/case statement in
the same form. To date, this has not caused any problems.
Should I be closing the recordset at the end of each sub, or do the close be
default when that event is done?
I am still getting my recordset feet wet. Any thoughts?
PJ
declare the recordset variables that I use like so:
Public cn As ADODB.Connection
Public rst As ADODB.Recordset
Public strSQL As String
Then, in a given form, I will use the rst like so:
Private Sub Form_Load()
Set rst = New ADODB.Recordset
Set cn = CurrentProject.Connection
strSQL = "SELECT * FROM tSomething"
rst.open strSQL, cn, adOpenStatic, adLockOptimistic
If rst!lngULevel Then
Do This
Else
Do That
End if
End Sub
Then I may use the exact same set up with a different if/case statement in
the same form. To date, this has not caused any problems.
Should I be closing the recordset at the end of each sub, or do the close be
default when that event is done?
I am still getting my recordset feet wet. Any thoughts?
PJ