generate auto numbers

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to generate a number that increments by one automatically in a
form. I then need to reset this field so it starts at zero at the beginning
of every year. Please help!!
 
SaGe said:
I am trying to generate a number that increments by one automatically
in a form. I then need to reset this field so it starts at zero at
the beginning of every year. Please help!!
You will have to have a table that maintains the number and call it in code
with dLookup, then increment it by one and update the table INSERT INTO is
one way to do it.

If this is a single user situation then that and code to determine when to
reset the value is all you will need.
If multi-user then the Access Developers handbook has code that will be
fairly bullet proof. It's worth buying just for that alone.

Restarting at zero and other such schemes are rarely needed in a database
situation since queries can give you the order and count without the problem
of finding out if this was number 9 from this year or three years ago..
 
I suggest you may not want to use Autonumber for that use. Autonumbers are
designed to provide unique numbers. It in not designed to provide numbers
in order and for a number of reasons may not do so. As a result using them
in any application where the user sees the numbers is likely to end up with
confusion.

There are other ways of providing the numbers you want depending on the
particual application.
 

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

Back
Top