Default value (1 Viewer)

mschmucker

New member
Local time
Today, 10:29
Joined
Nov 4, 2010
Messages
8
I am using Access 2003. I have a database with a field "Shipper#" that I want the default value to 1 larger than the previous record. I also want to be able to override the number, sometime we will have 5 lines with the same shipper#, most rows will have a different shipper#. I have tried the following-Max("[shipper#]","tblschedule")+1 and I have tried:

Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(MySeqNo) Then
MySeqNo = DMax("Shipper#", "tblSchedule") + 1
End If
End Sub

What I get is 2 records with the same shipper# and then the third record increases by 1.

Any ideas one why every row does not increase in shipper#?
 

Beetle

Duly Registered Boozer
Local time
Today, 08:29
Joined
Apr 30, 2011
Messages
1,808
What I get is 2 records with the same shipper# and then the third record increases by 1.

Any ideas one why every row does not increase in shipper#?

Not sure what you mean by this. The code is only going to update the current row. Are you saying that you want to increment previous records as well?
 

mschmucker

New member
Local time
Today, 10:29
Joined
Nov 4, 2010
Messages
8
I want the numbers to increase for example 1,2,3,4. What I am getting is 1,1,2,2,3,3,4,4
 

Users who are viewing this thread

Top Bottom