If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
primary key duplicate record is not incremental
Hi,
When I duplicate a record in a form using a command button, the primary key of the newly created record does not continue from the last one. For example, if the last one is 1410, and I want to duplicate record 1157, the new one is a random number (i.e., 545687). Any idea how to fix this? cheers, Gonzalo |
#2
|
|||
|
|||
primary key duplicate record is not incremental
On Tue, 9 Mar 2010 16:56:02 -0800, Gonzalo
wrote: Hi, When I duplicate a record in a form using a command button, the primary key of the newly created record does not continue from the last one. For example, if the last one is 1410, and I want to duplicate record 1157, the new one is a random number (i.e., 545687). Any idea how to fix this? cheers, Gonzalo Have you set this table's autonumber field (note: a primary key is not necessarily an autonumber and vice versa) to Random rather than Increment? or have you Replicated the database, which will do just this? And if not, could you post your code? -- John W. Vinson [MVP] |
#3
|
|||
|
|||
primary key duplicate record is not incremental
On Tue, 9 Mar 2010 16:56:02 -0800, Gonzalo
wrote: You could change from AutoNumber to Long Integer and take full responsibility for generating your own PK value, perhaps in the BeforeInsert event of your form. But MUCH better is to treat the PK as "any non-duplicating long integer", and not care what the value is. And never display this value to users. This is a FAQ; you should not have any trouble finding related posts, e.g. at groups.google.com. -Tom. Microsoft Access MVP Hi, When I duplicate a record in a form using a command button, the primary key of the newly created record does not continue from the last one. For example, if the last one is 1410, and I want to duplicate record 1157, the new one is a random number (i.e., 545687). Any idea how to fix this? cheers, Gonzalo |
Thread Tools | |
Display Modes | |
|
|