Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Mar 2009
    Location
    Hong Kong
    Posts
    359
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I would like to have Access to automatically generate a unique document number.
    Is it possible? How?
    Thanks in advance.
    Armstrong

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Does the number have to conform to a specific format?

  3. #3
    3 Star Lounger
    Join Date
    Mar 2009
    Location
    Hong Kong
    Posts
    359
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='772455' date='27-Apr-2009 15:40']Does the number have to conform to a specific format?[/quote]
    I'm sorry. It should read as follows:
    00001
    00002
    00003
    00004
    ...

    BTW, I'm just a beginner of Access.
    Thanks a lot.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    The simplest solution is to add an AutoNumber field to the table and set its Format property to 00000. Access will automatically increase the value by 1 for each new record.

    Alternatively, you could use a Number field of size Long Integer and increment it using VBA code. You'll find two approaches in Post 287907.

  5. #5
    3 Star Lounger
    Join Date
    Mar 2009
    Location
    Hong Kong
    Posts
    359
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='772461' date='27-Apr-2009 16:01']The simplest solution is to add an AutoNumber field to the table and set its Format property to 00000. Access will automatically increase the value by 1 for each new record.

    Alternatively, you could use a Number field of size Long Integer and increment it using VBA code. You'll find two approaches in Post 287907.[/quote]
    HansV,
    Thanks a lot.
    Armstrong

Posting Permissions

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