Link to home
Start Free TrialLog in
Avatar of prvijesh
prvijesh

asked on

Get next Id from a table in MS Access

Hi guys,

I want to get the next id (primary key, autonumber) of table without using max(id). beacuse max(id) wont give the next id if the table contains no rows. i think some system table stores the next sequence of all auto number fields of tables. (in sqlite there is sequence table which holds the next id of all primary key(autoicrement) fileds). Any one know how to get the next id from system table in MS Access(2003, 2007).

Thanks
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

you just use ..
nz(dmax("ID", "tablename"),0)
SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial