Default Values

Senerie

New member
Local time
Today, 12:58
Joined
Jul 3, 2002
Messages
8
I have several fields in a table that contain mostly sequential numbers. Auto number doesn't work for these fields, as the table contains imported data, and the numbers don't start at one, and there are a few gaps and repeats. Also, I need some flexibility in assigning the numbers.

When I'm entering new data in a form, I would like the default value for these fields to be the previous number plus one, so that I can either accept that number or type in a new one. Is there any way to do this?

Thanks!
 
This is the code that I use in my orders.

If Me.NewRecord = True Then
Me!OrderNumber = Nz(DMax("OrderNumber", "Orders", ""), 0) + 1
End If

OrderNumber is my field name so when a record becomes current I have it search the orders table and see what the highest number is then add one to it and place it in the order number field.

HTH
Shane
 
Thanks! That's just what I was looking for!
 

Users who are viewing this thread

Back
Top Bottom