Auto assign the primary key

P

Patti

Hi!

I apologize if this has been asked recently -- I haven't
had any luck with the search function.

I'm creating a data entry form that feeds a table, tblPO.
The first field in the table, Record, is the primary key.
I'd like the form to assign the next available number.

How do I do this?

Thanks!
 
D

Douglas J. Steele

Create a new table that's identical to tblPO, except make Record an
Autonumber field, not a numeric one.

Write a query to append all of the existing data in tblPO to the new table.
The next row you enter will have Record one greater than the highest number
used so far.

Note, though, that Autonumbers are not guaranteed not to have gaps in them.
If it's important that you have consecutively numbered values, you may want
to reconsider using an Autonumber.
 
Top