Results 1 to 7 of 7

Thread: auto number generation for multi user environment

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2001
    Location
    India
    Posts
    7

    Question auto number generation for multi user environment

    Hi,
    My client wants that from 3 different machines sales bill will get generated.Bill no should be prefixed with A,B,C.But these alphabets should not be machine specific.Any machine should be able to generate any alphabet provided no other machine is using that alphabet at that moment of time.
    can any 1 give me some idea?

  2. #2
    Fanatic Member rudvs2's Avatar
    Join Date
    Mar 2001
    Location
    NZ
    Posts
    935
    Okay are you using clients running on each workstation connecting to a central database??

  3. #3
    Addicted Member eanilarora's Avatar
    Join Date
    Aug 2000
    Location
    Malaysia
    Posts
    179
    i would have done it this way !!

    take a seperate new table which just stores the last sequence no... Add one to that no (prefix with 'A' B or C whatever way u require) before inserting into your main table and update this table with the new no....

    Anil
    Love, Live, Laugh

  4. #4

    Thread Starter
    New Member
    Join Date
    Nov 2001
    Location
    India
    Posts
    7
    Yes sir, I am using a central database.And my client machines will connect to tha database via DSN

  5. #5
    Fanatic Member rudvs2's Avatar
    Join Date
    Mar 2001
    Location
    NZ
    Posts
    935
    okay create a new table in the db

    when each client runs have it generate a random prfix eg "ABC" connect the client to the db and check the table for this prefix
    if the prefix is not found add this prefix to the table with the machines name eg the table will have two fields "Prefix" & "Comp Name"

    When the client exits have it reconnect to the db and delete its entry

    this way every client will have a unique prefix

  6. #6

    Thread Starter
    New Member
    Join Date
    Nov 2001
    Location
    India
    Posts
    7
    Dear Anil.
    I know how to auto generate a number.My problem is that How can I Find out that for a particular machine which alphabet should be prefixed.
    There r three machines generating auto bill no.Bill no can start with A,B,C only.If any other machine is using A then no other machine can use A.But can use B or C.How can I keep track that which particular alphabet is free to be used by a particular machine

  7. #7
    Addicted Member eanilarora's Avatar
    Join Date
    Aug 2000
    Location
    Malaysia
    Posts
    179
    Originally posted by kuntal
    Dear Anil.
    I know how to auto generate a number.My problem is that How can I Find out that for a particular machine which alphabet should be prefixed.
    ooops.... maybe i misread ur question in a hurry....

    anway...

    ok...here it goes...

    take one new table..."AB" in one record there...

    Whenever no is to be generated check this record, take the first character and update the table after generating like this :

    if "AB" then update with "BC"
    if "BC" then update with "CA"
    if "CA" then update with "AB"

    so everytime person generates the no he/she will get the new generated character....

    I hope it works for u this time.... (theoritaclly it should)...

    tell me if it does... (makes me happy.... )


    Anil
    Love, Live, Laugh

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width