PDA

View Full Version : there is a problem of auto number!!


NinjaTurtle
10-30-2002, 01:34 AM
dear,

i have one proble, let's giv u all some senario 1st:

i want to generate a Invoice number, so after user fill in the details and press submit, system will generate a auto number from a table call "Invoice_SerialNumber" and then get a serial number then add with the rest details into a Table called "Invoice", then add one(+1, number increase) into table called "Invoice_SerialNumber", there is same Serial number happen when there are 2 or more users press the submit button at the same time!!!

ofcos invoice number is not allow same number! how 2 solve this problem???? any function or key to lock the table after the transaction is done, then release the table to the following transaction? or the best is Queue the transaction!!!

whammy
10-30-2002, 03:21 AM
You must be using something besides the primary key (autonumber or autoincrement), which can't be duplicated. Have you tried using that instead?

victoria_1018
10-30-2002, 07:27 AM
did you generate by writing a script or generate from the database itself?

I think it will be better if toy wrirte to generate the number.

saeed
04-09-2003, 07:17 AM
hello guys,
is there any script which does the same for me.
actually I dont want to use autonumber option of Access
I want to do this thorugh code.
see how this can be happen. there will be a field id_no
its initial value will 0 when a user clicks on Add button
your code will stores its max value in a variable and makes +1 increment to it. :)

too easy.... but unfortunatly I can do this. :(
I just know how to make alteration is someones code.


any help will be appreciated.

Saeed.