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

Copy/Append

Status
Not open for further replies.

ZX188

Technical User
Mar 30, 2001
21
US
I need a command button that copies and appends a record to the next consecutive record which already exist except for 1 field which is the primary key. I have tried the Command button with the wizard but it wont work because of the primary key field

Thanks
Kevin
 
Hi Kevin,
Because of the primary key issue (I guess you are "picking up" an existing record with its PK and trying to dump it in again?) How about building an append query: Base it off of every field you want with the exception of the PK and have your command button run the query, then requery your form and move to the last record. If you're using an autonumber you're all set. If you use something else you may have to add something in the append of the PK like Forms!yourform!PKfield+1 or append the new PK a value like "FixNow!". Using Docmd.Setwarnings False, then DoCmd.Setwarnings True on the exit of your subs error handling (mandatory) you won't know anything has happened. :) Gord
ghubbell@total.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top