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

Copying a record in a subform 1

Status
Not open for further replies.

jasonmac

Programmer
Nov 14, 2002
175
US
Hello everyone. I'm working in Access '97. I have a form that records information on quotes. In this form there is a subform that holds a great deal of information about the part numbers contained in the quote. Sometimes the parts as very similar and my users want to be able to copy a record in the subform. From what I understand I need to select the current record, Copy the current record and then paste append the copied record. I would like to accomplish this using a command button. Can anyone give me the syntax?

Thanks in advance,
Jason
 
eh, when you say copy and append record, do you mean to copy an entire record in a table, and append that to the same table?

if that's the case, then you can't, cos you'd create duplicates...
 
Yes that's what I was talking about. And I believe that you should be able to. I created a sample table in which the primary key was an autonumber called RecordNo. I then created a sample form for this table. I then went to Edit->Select Record, then Edit->Copy, then Edit->Paste Append. Access then pasted the record to the table and simply changed the RecordNo to the next autonumber. So it is possible. I need to know how to do it programmatically.

Thanks again,
Jason
 
Take a look at the DoCmd.RunCommand method (acCmdCopy, acCmdPaste) and the DoCmd.GoToRecord method (acNewRec).

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks PHV. This is what I ended up using.

DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdPasteAppend

It works exactly as it did when I was doing in manually.
 
I'm having a huge problem with this because the form i'm using it with contains a tab control. It is only copying and pasting the information on the first page of the tab control. Can someone PLEASE tell me how to get around this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top