How do I create a random number with 3 alaph and 9 digits
Posted on 2007-10-14
I have a web form and I am using the FormView data control connected to an AccessDataSource. I am using the web form as a data entry page.
When I click on the Insert button (from the Insert Item Template) to add the new record to the DB table I would like to have an random number like ACN999999999 generated and automatically filled into to the AutoID Field OR is it better to have random number like ICN999999999 generated and automatically filled into to the AutoID Field when the page loads or opens?
To make sure I do not have duplicate AutoID Numbers will the code have to query against tblAutoInventory AutoID field?
I would like to have a random number because the I do not want to use the default AutoNumber and so I can create one to one and one to many relationships with other tables that I will have in the future. If you have a better sugestion please let me know?
NOTE: Instead of using a random number like ICN999999999 I thought of combining the the following to create a unique ID. The Information will come from the form fields that I have to fill in.
Default Fixed Value: ICN (Inventory Control Number Automaticall filled in)
AutoMFGNumber: 12345 (Ford)
DateRecordCreated: 1014071100PM (Date/Time Field -- System Inserts Time in the field Automatically)
Please HELP me understand how this can be done with VB code.
Thank you in advance,