Easy way to set max(id)+1 as field default value

E

ebolton

Instead of using autonumber (I am linking to an Oracle table), I would like
the default value of a new record to be the max(id)+1. I tried creating a
query that returns the max(id)+1 and using that for the default value but I
get an error. Any suggestions?
 
S

Shane S via AccessMonster.com

Hey Bolton,

I think this should work for you:

YourFieldName= Nz(DMax("YourIDField", "Orders", ""), 0) + 1

However, there are advisable reasons for not doing this as an ID field.

HTH,
Shane
 
E

ebolton

Thanks Shane! it worked like a charm! I know it's not ideal for a unique id
but I just needed something quick and dirty! Thanks again :)
 
Top