Duplicate Query

cktcPeterson

Member
Local time
Today, 07:16
Joined
Mar 23, 2022
Messages
74
On my form I want to duplicate a record but be able to update the ID number.
Is this possible?
 
No. If it is an autonumber it cannot be edited. You would need to add your own.
People do this all the time when they have to have sequential number for some reason. They are just visual, I would still use the autonumber as the primary/link field.
 
you can use an insert query to insert a new record, if your ID is an autonumber then ignore that field, otherwise pupulate with whatever calculation you are doing

code would be something like

dim sqlStr as string
sqlStr="INSERT INTO myTable (fieldA, fieldB, fieldC etc) VALUES(" & txtField1 & ", " & txtField2 & ", " & txtField3 & etc & ")"
currentdb.execute sqlstr
 
Think carefully. You don't want to just use an Insert query to copy data without changing anything. Usually, we do this with a form, you copy the record and populate a new record with the values but you don't automatically save the record. You just fill the fields. The user has to add the new information and use the save button to save the record. Otherwise, you just end up with garbage.

Now do you want to discuss this further?
 

Users who are viewing this thread

Back
Top Bottom