Click here to Skip to main content
16,010,553 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello

I have windows form application databinded to accdb database in access 2007. now , I have a form where I input data for maintenance of some inventory. Thing is I want to have unique numbers for each of this input for example: 2011_178
where 2011 represents the current year and 178 is unique number for each input

but I want that on load form to opens automaticaly the next number in textbox so that later on I can look for by that number the specific input
so if yesterday I had couple of inputs
and ended
with 2011_178, then on next load it must show 2011_179 and of course I must have a save button because if I don't save it then 2011_179 wont be saved, and next time I load form it again opens that number.

I have multiple users of this application so the need of automatically producing this number is something I require.

Can anybody help me with some advice
Posted

1 solution

Use a counter as primary index in your database table, when you load find MAX(yourindexcounter), add 1 and propose as value in your text field ... :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900