Duplicating a Record

ions

Access User
Local time
Today, 09:55
Joined
May 23, 2004
Messages
823
Dear Access Programmers.

My client wants to be able to duplicate a customer record and then make some changes to the new record to reflect a new Customer.

When in a table I can copy and paste a record manually. (However, I have to be careful to change the Unique fields")

Can I achieve this Copy and Paste behavior using VBA. Is it possible?

I know the usual way to do this is to cycle through each field, save it, and then assign it to the new record's field. If the Above Copy and Paste is not possible using VBA can you refer me to some code that cycles through all the controls on a form, omits non-data controls such as subforms, and stores the results in an array.

Thank you so much.
 
Use an SQL INSERT statement and build the criteria on the fly:

Code:
INSERT INTO CustomerTable(Field1, Field2, Field3, Field4...)
       SELECT Field1, blahBlahBlah as Field2, Field3, BlahBlahBlah as Field4...
         FROM CustomerTable
       WHERE CustomerID = xxx
 

Users who are viewing this thread

Back
Top Bottom