303factory
Registered User.
- Local time
- Today, 11:32
- Joined
- Oct 10, 2008
- Messages
- 136
Hi
I'm looking at how to duplicate an entire row of data in my table (apart from the autonumber primary key, I'd want this to assign a new value)
I've been trying the following code:
The problem here is that it will try and duplicate the primary key as well which obviously is not going to work. Is there a way to create a SELECT statement that is all fields except for the primary key?
I dont want to write out every field because 1) there are loads 2) I want it to work on any table 3) i want the code to work when we expand the number of fields in the table (happens quite frequently)
Is there perhaps another cunning way to duplicate a row?
Cheers
303
I'm looking at how to duplicate an entire row of data in my table (apart from the autonumber primary key, I'd want this to assign a new value)
I've been trying the following code:
Code:
cmdstr = "INSERT INTO tblExhibitInfo SELECT * FROM tblExhibitInfo WHERE Exhibit =" & Chr(39) & strExhibit & Chr(39)
gSQLdbase.Execute (cmdstr)
The problem here is that it will try and duplicate the primary key as well which obviously is not going to work. Is there a way to create a SELECT statement that is all fields except for the primary key?
I dont want to write out every field because 1) there are loads 2) I want it to work on any table 3) i want the code to work when we expand the number of fields in the table (happens quite frequently)
Is there perhaps another cunning way to duplicate a row?
Cheers
303