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

select, copy, paste append using vb

Status
Not open for further replies.

MushMouse

Programmer
Mar 29, 2004
65
US
I have a datasheet form & would like to automatically select, copy & paste append a record when the user checks a checkbox.
I coded

DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdPasteAppend

in the check_afterupdate event, but it keeps appending a blank record instead of the one which contained the checkbox. I tried selecting the record & then clicking the checkbox, but I got the same results.

Any advice would be much appreciated!

Thanks!
 
did you try
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdPasteAppend
 
I tried it. I got a message saying it was unable to paste the records, & they were put in a paste errors table. So I closed the form, went to the paste errors table, copied the record, reopened the form, & was able to paste it using the paste append button with no problem. But I don't understand why it's not working when I try to automate this process in VB.....
 
If the table has a primary key then that is probably your problem. If not I would say time for a little sql look into an apppend query.

Insert into tblA (fld1, fld2,fld3)Select fld1, fld2,fld3 from tblA where recordnumber= 123

the query will at least tell you why it was not able to paste the records.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top