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

Create autonumber

P: n/a
May anyone can teach me to assign a autonumber, I want to create a
number that is starting with year (auto change to year 2006) +
autonumber (eg. 2005-1001, 2005-1002 and so on)
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Rog
It is not a good idea to use an autonumber for anything else than a
record key behind the scenes, invisible to the user. If you want
numbers like the ones you describe you should use a counter and add 1
for every new record.

Nov 13 '05 #2

P: n/a

Apple wrote:
May anyone can teach me to assign a autonumber, I want to create a
number that is starting with year (auto change to year 2006) +
autonumber (eg. 2005-1001, 2005-1002 and so on)


Apple,

As Rog so eloquently said, to not use the Access autonumber system.
While I have never had any problems with it, I continue to read from
well informed developers to not use it. Better to use a unique table
to store your record numbers in. If you wish to creat a number with
the year, you can steal the clock date and place it into a memory
variable. Then read the top number from your unique number table.
Place that value into another variable. The third variable will
combine the values from the first two in the format you wish. I built
one in 1999 that reads the clock date, format out the last two digits
of the year, read the top number of the record table, marry the two
values and display it in text box that is not allowed to be modified by
the user. This way the number values continue correctly. Then the
form into which they input the record into the datebase is modal and
the only way out is to click on the OK or the Cancel button. If the
Cancel button is used, the number is not stored anywhere. The number
is stored only when the OK button is clicked and certain fields are
dirty. You can do what you want here. I hope this is some help for
you to get started either producing or ask more questions.

FlSteve

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.