Auto Populate a Field

D

David George

Is there a way to get a field in a table to be autopopuated with and
ascending number?
 
S

Steve Schapel

David,

Well, an Autonumber field does this, pretty much, though it does have
limitations.

Alternatively, on the form that you are using to enter data to the
table, you can set the Default Value property of the control for the
field to the equivalent of...
DMax("[NameOfField]","NameOfTable")+1

However, this will only work on a Single view form. If you are using a
Continuous view form, you will need to use the Before Insert event of
the form, to apply a macro or VBA procedure. If a macro, you would use
the SetValue action, with arguments like this...
Item: [NameOfYourField]\
Expression: DMax("[NameOfField]","NameOfTable")+1
 

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