By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,081 Members | 2,118 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,081 IT Pros & Developers. It's quick & easy.

default set to 'max+1'

P: n/a
Hey folks -

I have a field that is a number. For new records, I want it to default to
the highest value of that field +1. What is the syntax for the default
value?

Steve Lefevre
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Steve Leferve wrote:
Hey folks -

I have a field that is a number. For new records, I want it to default to
the highest value of that field +1. What is the syntax for the default
value?

Steve Lefevre

If an autonumber's no good for you (and it's no good for anyone but the
machine!!!) then don't ever use a default value in this way, two people
open the form and add a record they'll get the same number, horrendous
results.

Use a BeforeUpdate procedure, e.g.

(air code)
Sub Form_BeforeUpdate(Cancel As Integer)
If isnull(MySeqNo) Then
MySeqNo = Nz(DMax("MySeqNo","MyTable"),0)+1
end if
End Sub

--
But why is the Rum gone?
Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.