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

duplicate record

Status
Not open for further replies.

yuchieh

MIS
Jul 21, 2000
178
US
I would like to create a onclick command button for users to duplicate records. However, there is an auto-number (unique ID). How do I set it up to generate the auto-number?

Thanks
 
Just set it up to copy the other fields. The autonumber will automatically be added upon a new record being created.


Bob Larson
A2K,A2K3,A2K7,SQL Server 2000/2005,Crystal Reports 10/XI,VB6, WinXP, and Vista
Free Quick Tutorials and Samples:
 

Is this a situation where you occasionally want to go to a certain record and copy a bunch of fields to another record or are you doing batch entry of records where certain fields are being entered time after time?

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Sorry I didn't make it clear. Actually users want to find a record from the form and duplicate the record as a new record in the form. Maybe just change the values in a couple of fields in the new record. It would be one record at a time, not batch.

 

This copies the fields you want carried over to a new record, then the user can fill in the other fields:

Code:
Private Sub CopyPartiaRecordl_Click()

'Copy fields from original record to variables
NewField1 = Me.YourField1
NewField2 = Me.YourField2
NewField3 = Me.YourField3

'Go to a new record
DoCmd.GoToRecord , , acNewRec

'Plug in old values from variables into new record
Me.YourField1.Value = NewField1
Me.YourField2.Value = NewField2
Me.YourField3.Value = NewField3

End Sub




The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top