Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Recordset from another Recordset... 1

Status
Not open for further replies.

xinyin

Programmer
Jan 16, 2003
81
0
0
HK
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?
 
Here is what my version of the help says:

MSDN Library said:
Parameters

FileName Optional. Complete path name of the file where the Recordset is to be saved.

PersistFormat Optional. The format in which the Recordset is to be saved. Currently the default, and only, valid value is adPersistADTG.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top