Results 1 to 2 of 2

Thread: ID with prefix

  1. #1
    Join Date
    Dec 2002
    Posts
    1

    Question Unanswered: ID with prefix

    We would like to create an unique ID with the date(year) as the prefix...
    ed: 20020001... 20020002.... or 20030001..... where 2002 prefix, and 0001 auto generated...
    It should be created every time you add a new record and if possible without to many code within it...

    Anyone an idea to help us out?

    Tnx,
    Kevin.

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    you probably can get there with
    DMax("[FieldNameOfID]", "NameOfTableWithID")+1
    to return the next ID plus some /10000 integer calcs to get the year to change for the first entry in a new year.

    but you complicate your life and limit your db to 9999 entries/year

    perhaps you can achieve what you want with a year field and an autonumber field. create your yyyyidid from this pair if/when you need it.



    izy

Posting Permissions

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