Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autonumber generator (with number code in front)

Status
Not open for further replies.

hrg

Programmer
Jan 8, 2009
46
US
I have a database and i have a combo box. within the combo box the user may select 4 options

1, Pro
2, May
3, May ord
4, SLD

These options also have a code

Pro 50
may 51
may ord 52
sld 53

i have a button that when it is clicked it generates a number (like autonumber).

What i would like is when one of the options is select then the code goes in front of the number generator how would i do this?

e.g.

select Pro

click button it generates [5001]

select sld

click button it generates [5302]

etc

How do i do this?
 
To do it the way your suggesting will limit the number of values you can have e.g. 5301 - 5399 etc.. And even if you have the counter as 3 digits, sooner or later you will hit a limit.

To what purpose are you putting need this reference?

If you are saving the action in a table i.e. creating a record for the action, it would be much better to store a reference to the option selected.
So the Option table would have ID (autonum), Code ("50", "51" etc) and Description ("Pro", "may" etc) and the "saved action" table would have its own ID field (autonum) as well as a field holding the option.ID value of the option that was selected.


M :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top