Results 1 to 4 of 4
  1. #1
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Custom autonumber (Acees 2000 >)

    I looked at the search and found 2 or 3 posts about customising an auto number with text. But I need aditional explaination of how to do this please.

    Say I have a form, and I want a automatic number generated, that has text included: TFC1, TFC2, TFC3....
    How can I do this? Also must my table have additional fields to store the constant TFC???
    Please guide me throuh the steps to create this autonumber again!
    Tx
    Regards,
    Rudi

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Custom autonumber (Acees 2000 >)

    There are a couple of strategies you can use. One is to store the text prefix in a separate field, and use a simple autonumber field type in a second field. When you display them, you use the concatenation operator to make them appear as a single field, and you can also create a primary key that includes both of the fields.

    The second strategy is to actually use DAO (or ADO) when a record is added. In that case you store either the last number used, or the next number to be used in a single record table. When the user adds a record with a form, the table containing the autonumber is opened, that number is used with the new record, and the autonumber is incremented by 1 and saved in the single record table in preparation for the next new record. This approach allows you to store the complete number in one field. However if you allow people to add records at the table level rather than using the form, then the wheels are likely to fall off.
    Wendell

  3. #3
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Custom autonumber (Acees 2000 >)

    Thx Wendell. I'll experiment with the first suggestion and see if I can get it running! This option sounds easier for me!
    Cheers
    Regards,
    Rudi

  4. #4
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Custom autonumber (Acees 2000 >)

    Hi Wendell. The first suggestion worked perfectly.
    Cheers for that advice!
    Regards,
    Rudi

Posting Permissions

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