1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

MS-Access: tricky autonumbering

Discussion in 'Other PC Software' started by Lancer, 2002/11/22.

Thread Status:
Not open for further replies.
  1. 2002/11/22
    Lancer

    Lancer Inactive Thread Starter

    Joined:
    2002/01/07
    Messages:
    48
    Likes Received:
    0
    I want to make an access database for handling invoices. The invoice should have an INVOICE_ID (perhaps the primary key) in the following format...

    02-BRA005-001
    ...where...
    "02" (first two digits) is the invoice year
    "BRA005" is the first 3 letters of a surname and then the clientID (autonumber) for the client
    001 (last 3 digits) is kind of like the primary key for "this invoice "

    ...but there's a catch. When the year rolls over (from 02 to 03 for example) I want the last three digits to reset themselves back to 000 for the next invoice of the new year, for any given client.

    Therefore, if I make invoices every three months (roughly), they should have an auto code attached (perhaps the primary key for the invoice) like so...

    ==========================================
    Invoices for Jone Braspire (clientID: 005)
    02-BRA005-001 (this is for January 2002)
    02-BRA005-002 (this is for March 2002)
    02-BRA005-003 (this is for July 2002)
    02-BRA005-004 (this is for November 2002)
    03-BRA005-001 (this is for February 2003)
    03-BRA005-002 (this is for May 2003)
    03-BRA005-003 (this is for August 2003)
    03-BRA005-004 (this is for December 2003)

    Invoices for Rachel Matthews (clientID: 007)
    02-MAT007-001 (this is for January 2002)
    02-MAT007-002 (this is for March 2002)
    02-MAT007-003 (this is for July 2002)
    02-MAT007-004 (this is for November 2002)
    03-MAT007-001 (this is for February 2003)
    03-MAT007-002 (this is for May 2003)
    03-MAT007-003 (this is for August 2003)
    03-MAT007-004 (this is for December 2003)
    ==========================================

    See the pattern? Looks simple on paper but I'm a newbie (using "SAM's Teach Yourself Access 97 in 24 hours" as a reference, although I'm really using Access 2000) and I can't figure how to make autonumbers in a repeating sequence like this (last digits refreshing themselves accoring to rollover of the first digits).

    ...come to think of it, I don't even knowhow to make "3" display as "003" in part of the ID code.

    Of course, each invoice will have dosens of transactions in a one-to-many subtable. Hopefully I will be able to do this and still maintain an ongoing record of "Invoice history ".

    Help appreciated.
     
  2. 2002/11/23
    jmatt

    jmatt Well-Known Member

    Joined:
    2002/01/12
    Messages:
    189
    Likes Received:
    0

  3. to hide this advert.

  4. 2002/11/23
    Lancer

    Lancer Inactive Thread Starter

    Joined:
    2002/01/07
    Messages:
    48
    Likes Received:
    0
    :) I'm not scared of RTFM, so thanks heaps for all those links! Around here no one's really into Access that much except for businesses who place huge prices on anything, but my friend doesn't have any more money to spend on them (thou$ands gone already), and I could certainly do with the upskilling if I'm to help her. Hopefully those courses might have the answers I'm seeking :)

    Thanks heaps.
     
Thread Status:
Not open for further replies.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.