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

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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
 
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 :-)
 
Back
Top