VBA to clone recordset then go to newly created clone

tmyers

Well-known member
Local time
Yesterday, 21:00
Joined
Sep 8, 2020
Messages
1,091
Today seems to be a VBA kind of day.

I have a process that clones a recordset then prompts the user to name the newly create clone via an Inputbox.

I then typically use a combobox populated with the name of the original and all clones to navigate to each record. I however want to add in the code that after the clone is created, go to that record. This is to prevent the user from think the form is on the newly created clone, when it is in fact not until they select it in the combo.

I have the user value from the Inputbox as strinput.

I tried:
Code:
DoCmd.GoToRecord acDataForm, "JobQuote", acGoTo = "[RevisionName] = '" & strinput & "'"
But that failed.

What did a mess up on?
 
Hi. Not sure I follow. You may be using the terminology a little differently. As far as I know, you don't "name" a cloned recordset. Instead, you assign it to a recordset variable.

Are you maybe referring to a cloned record?
 
The code takes the record and all child records and clones/copies them. I then use strinput to update a field [RevName] to identify it from the original. So all records are the exactly same (at time of creation) except for their [RevName] in the "master" table.

I then use a combo that is populated with the [RevName] that allows the user to navigate to each particular one. The code that creates all of this however, doesn't navigate/filter you to the newly created record and the time it finishes, which I think is unintuitive.

Does that help clear it up a little bit?
 
Does that help clear it up a little bit?
Yes, you are using the term "clone" to mean duplicating records. Access also has a method called RecordsetClone, which means something else.
 
Yes, you are using the term "clone" to mean duplicating records. Access also has a method called RecordsetClone, which means something else.
Ah. I tend to use incorrect terminology a lot. Makes finding things via Google searches quite rough!
 
Ah. I tend to use incorrect terminology a lot. Makes finding things via Google searches quite rough!
For example, a Recordset is an object. It has a property called RecordsetClone, which is a copy of itself. But, that doesn't mean you'll now have double the number of records in your source table.
 
I could believe it. The code I wrote out to do the cloning/copying is a monster. It is very long. It works though :)
 
Found that code really useful @MajP ! But I am trying to copy records on forms with multiple subforms (related tables) - have enclosed a basic sample of what I'm working on...
Would really appreciate help on coding the cmdCopySession for this form.
 

Attachments

Users who are viewing this thread

Back
Top Bottom