Obtaining the next Primary Key

  • Thread starter Thread starter GilgameshW
  • Start date Start date
G

GilgameshW

Is there a way to obtain the next primary key in a table?
For example I have created a table called T_UNITREP which
as a primary key called REP_PK (autoincrement) and some
other fields.
Now when I insert rows into the table I want to be able to
get the next available REP_PK value. Sometimes I need to
delete rows, so when I insert how do I know what the
REP_PK is before insertion ??
 
You don't need to do this. When you insert a record into a
table with an autoinc field, you do not include that field
in the query. Access adds it automatically.
 
Back
Top