I want to duplicate a record in the same table - all the data except the key field, of course. The append query is easy enough. For example, here I am duplicating record #2 in my test table called zzTblJunk:
INSERT INTO zzTblJunk ( Field1, Field2, Field3 ) SELECT zzTblJunk.Field1, zzTblJunk.Field2, zzTblJunk.Field3
FROM zzTblJunk WHERE (((zzTblJunk.RecID)=2));
However, with real data there are dozens of fields in the table. I'm trying to shortcut itemizing each and every field of the table in the INSERT and SELECT statements.
If the table has no key field or indexes that don't allow duplicates, then this works:
INSERT INTO zzTblJunk SELECT zzTblJunk.* FROM zzTblJunk
WHERE (((zzTblJunk.RecID)=2));
However, that's not realistic. My real data does, of course, include a key field for the record. So the above syntax creates a duplicate value in RecID (the key field) and fails.
Does anybody know some magic syntax to easily duplicate a record into the same table without duplicating the key fields?
Thanks,
Joe
INSERT INTO zzTblJunk ( Field1, Field2, Field3 ) SELECT zzTblJunk.Field1, zzTblJunk.Field2, zzTblJunk.Field3
FROM zzTblJunk WHERE (((zzTblJunk.RecID)=2));
However, with real data there are dozens of fields in the table. I'm trying to shortcut itemizing each and every field of the table in the INSERT and SELECT statements.
If the table has no key field or indexes that don't allow duplicates, then this works:
INSERT INTO zzTblJunk SELECT zzTblJunk.* FROM zzTblJunk
WHERE (((zzTblJunk.RecID)=2));
However, that's not realistic. My real data does, of course, include a key field for the record. So the above syntax creates a duplicate value in RecID (the key field) and fails.
Does anybody know some magic syntax to easily duplicate a record into the same table without duplicating the key fields?
Thanks,
Joe