Automatic Refernece Number

Sean_Downes

New member
Joined
Jun 6, 2012
Messages
3
Programming Experience
Beginner
Im creating a system that allows me to click a button and it opens a new form with details that i can input. i want it to the save those details when i click send. But also i want a automatic reference number that increases by 1 everytime i click the button on form 1. Example:

I login to my system. I then click 'Create New CHS'. This then opens a new form called 'New CHS'. In the top right hand corner i have a read only box, i want that box to automatically state a new number everytime i open a new form. Can anyone shed some light please on how i can do that?

Thanks
 
You will be saving the records to a database and the database will be generating the numbers. In Access you would select AutoNumber data type for your primary key column. In SQL Server you would set the IsIdentity property of your primary key column to True. Other databases will have similar functionality. When you insert the new record into the database (NOT before) the database will generate a new ID, which you can then retrieve and display in your application.
 
Back
Top