I want to know if this is the right way to create a recordset base on the data from another recordset:
I have a recordset (RsetMain), its source is from a table of an Access database (.mdb) - I have no problem in creating this.
Now I want to make another recordset (RsetNew) which picks data from RsetMain. Here is the code I did which works for making RsetMain but not RsetNew:
Public WithEvents Cnet As ADODB.Connection
Public RsetNew As ADODB.Recordset
Public SearchLine as String
SearchLine = "SELECT ItemCode FROM RsetMain WHERE ...(some rules)"
With Cnet
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = _
"Data Source=" & RsetMain & ";" & _
"Persist Security Info=False"
.CursorLocation = adUseClient
.Open
End With
Set RsetNew = New ADODB.Recordset
With RsetNew
.CursorLocation = adUseClient
.ActiveConnection = Cnet
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open SearchLine
End With
Is the only way to do this is by ADO Command, not Recordset?
I have a recordset (RsetMain), its source is from a table of an Access database (.mdb) - I have no problem in creating this.
Now I want to make another recordset (RsetNew) which picks data from RsetMain. Here is the code I did which works for making RsetMain but not RsetNew:
Public WithEvents Cnet As ADODB.Connection
Public RsetNew As ADODB.Recordset
Public SearchLine as String
SearchLine = "SELECT ItemCode FROM RsetMain WHERE ...(some rules)"
With Cnet
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = _
"Data Source=" & RsetMain & ";" & _
"Persist Security Info=False"
.CursorLocation = adUseClient
.Open
End With
Set RsetNew = New ADODB.Recordset
With RsetNew
.CursorLocation = adUseClient
.ActiveConnection = Cnet
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open SearchLine
End With
Is the only way to do this is by ADO Command, not Recordset?