Default values populate automatically but increase by 1

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
 
P

Pavel Romashkin

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
 

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

Top