increment a value in a text box

J

john

How do I automatically increment the value in a text box
which is type integer when I add a new record? I am trying
to create a counter that increments each time a new record
is added. This seems like a trivial problem but I cannot
find any documentation on it. Help would be appreciated.
 
N

Nikos Yannacopoulos

John,

Are you entering new records through a form? I'll assume you do.In that
case, all you need to do is use the control's Default Value property, with
an expression like:

=DMax("[FieldName]","TableName") + 1

where TableName and FieldName are the names of the undrlying table and the
field the control is bound to.

HTH,
Nikos
 
D

dandgard

Try looking at the forms AfterInsert Event. This event only fires whe
you have added a new record to the underlying dataset for the form.
Just update a textbox each time you come to the event
 

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