CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 1999
    Posts
    5

    Creating a new invoice

    In my program I want to click a new invoice button that will clear all fields and in my invoice number field increase the number by one according to the highest invoice number in my database, but it won't. Any ideas? I really could use some help before tomorrow.

    Thanks
    Jessica Tracy


  2. #2
    Join Date
    Nov 1999
    Location
    Denver, CO
    Posts
    20

    Re: Creating a new invoice

    Jessica,

    If you could provide more information about which grid you are using , as there are different types, what Database type you are using would be helpfull. I have had some of the same problems in the past and the answers are different for each one.

    Email your replies and I will help.

    Allen Noakes
    VB Programmer/Analyst
    Dames & Moore Group
    [email protected]


  3. #3
    Join Date
    Nov 1999
    Posts
    5

    Re: Creating a new invoice

    In this program I am just using textboxes and I want my textbox to increment 1 from the highest invoice number already in my database. I am using DAO also. It seems like it should be so simple, but yet I can't get it to work. I'd appreciate any help you could give me.

    Thanks
    Jessica


  4. #4
    Join Date
    Nov 1999
    Location
    Denver, CO
    Posts
    20

    Re: Creating a new invoice

    The answer is as follows.

    Dim strSQL as string

    strSQL = "SELECT TOP 1 InvoiceNbr FROM Invoice ORDER BY InvoiceNbr DESC;"

    The "TOP 1" will return only one record which is all you need, "ORDER BY InvoiceNbr DESC" will get the largest invoice number in your database. This should work with either SQL Server or Access.

    Allen Noakes
    VB Programmer/Analyst
    Dames & Moore Group
    [email protected]


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured