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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cloning A recordset

Status
Not open for further replies.

MajP

Technical User
Aug 27, 2005
9,382
US
I need to get a copy of a Combo Box or List Box's recordset, not a reference to it. I want to manipulate the recordset, but at times set it back to the original recordset. There is no recordsetclone property for these controls. I did this and it works:

'Set rsCopy = CurrentDb.OpenRecordset(cmboTest.Recordset.Name)

But there are some limitations to using the name property. Is there another way that I am not thinking? I tried passing it byval to a function and then returning it, but that did not seem to work. Am I being dense here?
 
In ac2003:
Dim rsCopy As DAO.Recordset
Set rsCopy = Me!cmboTest.Recordset

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
MajP

If you just need a read-only copy of the recordset you could use the Save method of an ADODB recordset. You could open a new recordset

Dim Rst As ADODB.Recordset
Dim CopyRst As ADODB.Recordset
Set rst = .....
Rst.Open
rst.Save "c:\copiedRST..adtg", adPersistADTG
Set CopyRst=New ADODB.Recordset
CopyRst.Open "c:\copiedRST.adtg"
.....
 
not a reference to it
OOps, disregard my post :~/
 
Thanks Gents. I just did not look in the obvious place.
There is a clone function. Did not know that.
Code:
 Dim rsTemp As Recordset
 cmboFilter.SetFocus
 Set rsTemp = cmboFilter.Recordset
 Set rsList = rsTemp.Clone
 
Actually do not need the temp. Just simply

Set rsCopy = cmboFilter.Recordset.Clone
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top