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

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?
 
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
 
G

Guest

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 :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top