Default values populate automatically but increase by 1

  • Thread starter Thread starter Uriah
  • Start date Start date
U

Uriah

How do i get a default value (serial number) to increase
by one each time I hit "new record"? I am only vaguely
familiar with VB for Access so a lot of code will
probably be a bad thing. Sure would appreciate some help.
Thanks
Uriah
 
Put the following in the Current event of your form:

Dim Temp as Long
if Me.NewRecord then
Temp = DMax("SerialNumber", "MyTable")
Me!SerialNumber = Temp + 1
end if

assuming that your serial number is a Long integer.
Pavel
 
Back
Top