how to copy / paste records in subform?

polyubi

Registered User.
Local time
Tomorrow, 06:00
Joined
May 11, 2010
Messages
27
I have a mainform with a subform.
As I often need to input similar records in the subform, I made 2 button to copy the record and then amend some fields so that it becomes a new record. For copy I have this button:
Me.subform.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
Then for paste I have this button:
Me.subform.SetFocus
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdPasteAppend
But in practise I can only copy one record, no matter how many records I have selected. Appreciate any help from the gurus.
 
thanks for your help.
it seems your sample can copy only one record, same like my code. I want to copy all the records that user selected.
I think we need something like "for i=1 to .......(all records)" then loop.....,but I don't know how to write the code.
 
You can select more records in LIST BOX, do you
have a list box in subform???
 
Hey Mstef,

a record consist of textbox, listbox and combo as well. I need to copy whole record.
 
How about selecting the records from a listbox and then using code to execute sql to add these records?
 

Users who are viewing this thread

Back
Top Bottom