Results 1 to 6 of 6

Thread: Invoice Numbers

  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Posts
    989
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Invoice Numbers

    I have created an Invoice template and want each new invoice to suggest the next sequential invoice number. How can I use the Registry to store the latest invoice number? Is there another way to do this, perhaps using a Bookmark within Hidden text of the original template?

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Invoice Numbers

    >Is there another way to do this,

    Yes. Apart from my ongoing promotion (!) of INI files, I have functions that make use of the modules within a document.

    If you open VBE from Word (Tools, Macro, Visual basic Editor) and inspect your current document, you'll see that from the VBE menu you can "Insert" a "User Module". Do this.

    In the new module type some data - anything at all. Save, Close, reopen the document; you'll see (via VBE) that the data is there in the user module.


    It follows that a user Module is a handy place to store data associated with a specific document. I use this technique in my Document Generator, where the user keys in specifications to a regular Word table, and the table gets stored away in the User Module for later editing.

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Invoice Numbers

    Try searching for "invoice" here in the Lounge to find other suggestions.

  4. #4
    5 Star Lounger
    Join Date
    Mar 2001
    Posts
    989
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Invoice Numbers

    I tracked down an article that shows me how to use the Registry to store the invoice number. However, I would prefer not to use the registry if possible. I was thinking of storing the first number in the original template. When a new document is created I want to open the original template and read and adjust the next number from there. Is this possible?

  5. #5
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Invoice Numbers

    >open the original template and read and adjust
    the next number from there. Is this possible?

    Not if it is locked.

    If the template is not locked, it ought to be possible. I can't think of a reason why it oughtn't.

  6. #6
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Invoice Numbers

    Although possible, keeping the number in the template is a bit dangerous if the template can be used by more than one person at a time. Without getting into some rather tricky Windows API routines, there is no way to control who is updating the template when. The problem is the time gap between the time the template is used to create a new document, and the time when the code updates the number.

    Using the registry is also a problem if the template is going to be used by more than one person since each person would be getting and storing the number in their own registry. You would have to have a separate series of number for each person.

    I don't think you ever mentioned what environment this will be implemented in. Is this VB, or will it be VBA and if so will it be Excel VBA, Access VBA, or something else. There are a number of ways to do what you want, but the easiest depends on which environment you are working in. If this was Access, then you have a choice between an AutoNumber field (will not produce sequential invoice numbers in a shared environment), or using a record in a table in the DB. In Excel, I would probably use a separate file, which might be an .INI file if I had a number of different things to keep track of, or it might just be a file of my own design if this was the only thing I needed to put in it (I can write code to handle a very specific format that is much faster than Windows .INI file functions).
    Legare Coleman

Posting Permissions

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