Hi,
Can anyone help me with setting a recordset in a subform?
I've this code where i use the connection method to connect to a sql server
database. I can use it to set the recordset in a form and a subform, but
when i go the next record in the main form the subform's recordset stays the
same.
Here is the code:
Private Sub Form_Open(Cancel As Integer)
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
With rst
.Source = "SELECT * FROM MyTable1"
.LockType = adLockOptimistic
.CursorType = adOpenDynamic
.CursorLocation = adUseClient
.ActiveConnection = GetConnection(True)
.Open
End With
Set Me.Recordset = rst ' this is for the main form
Set rst = Nothing
End Sub
for the subform it goes somewhat the same. Anyone knows the problem?
Can anyone help me with setting a recordset in a subform?
I've this code where i use the connection method to connect to a sql server
database. I can use it to set the recordset in a form and a subform, but
when i go the next record in the main form the subform's recordset stays the
same.
Here is the code:
Private Sub Form_Open(Cancel As Integer)
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
With rst
.Source = "SELECT * FROM MyTable1"
.LockType = adLockOptimistic
.CursorType = adOpenDynamic
.CursorLocation = adUseClient
.ActiveConnection = GetConnection(True)
.Open
End With
Set Me.Recordset = rst ' this is for the main form
Set rst = Nothing
End Sub
for the subform it goes somewhat the same. Anyone knows the problem?