DMax + 1

T

Tina

I have a form and a subform. The form brings up the
Customer and then the subform brings up all records
pertaining to that customer. When I click the add button,
I want the next available record Id Number to be displayed
in the new record. It was suggested that I use DMax +1,
but I'm confused on what the code would look like and
where I should place it. Any help that can be given would
be greatly appreciated. Thanks!!
 
R

Roger Carlson

On my website(see sig below) is a small sample database called
"FormSubform.mdb" which illustrates this. Look at the code behind the
Subform.
 
W

Wayne Morgan

In the DefaultValue of the control try:

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

This should work as long as you only have one user writing new records to
the database. If you have more than one, you will have to "block" the number
from other users.
 

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

Similar Threads

DMax on existing record to increment serialized # fails 1
DMax 1
DMax sorting incorrectly 4
Forms 2
Populating a field in a record 1
New order subform 1
Copy Data from Subform 4
Quote Form With Options - Repost 3

Top