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

How to copy a form +usubform data

Status
Not open for further replies.

Rainer2000

IS-IT--Management
Joined
Apr 27, 2003
Messages
61
Location
DE
Hi,
I am using the following code to copy a recordset in a Form which has a linked subform:
DoCmd.runCommand acCmdSelectRecord
DoCmd.runCommand acCmdCopy
DoCmd.runCommand acCmdPasteappend

This copies the recordset, but unfortunately the fields in the subform remain empty, and I have not found a way to populate them by VBA. Does anybody know what's wrong ?

Rainer







 
Hi there

What is copied and where it is pasted depends where the focus is at the time of processing the code. Presumably your main form has the focus after the "SelectRecord" command so it is the main form record which is copied, not the related subform record.

You need to add code to give the subform the focus and then copy the subform record and paste it into the new subform recordset.

Hope this helps!

Regards

Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top