How to Create Auto Bill number in Data Report
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 13 of 13

Thread: How to Create Auto Bill number in Data Report

  1. #1
    Join Date
    Apr 2006
    Location
    Kolkata, India
    Posts
    273

    Post How to Create Auto Bill number in Data Report

    Dear Friends & Buddies,

    I have a Bill Receipt designed in DataReport, the other Fields are & could be placed in the report without any problems
    But I can not place the Bill number in the Page header section..
    Please help
    Thanking you
    Rahul

  2. #2
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,874

    Re: How to Create Auto Bill number in Data Report

    Because HEADER will print on every page, and can't be changed for each bill.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Apr 2006
    Location
    Kolkata, India
    Posts
    273

    Post Re: How to Create Auto Bill number in Data Report

    Dear Dglienna,

    I have one bill only, My client does not need to printout sheet after sheet.
    het wants one Page bill printout that too with : Invoice number: 001
    Where do I put the BillNo field.

    Please help.

    Thanking you
    Rahul

  4. #4
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    4,782

    Re: How to Create Auto Bill number in Data Report

    Set the data through code.

    I do not use the Vb data report. I use Active Reports instead but I think the Vb Data Report supports some of the same methods.

    In Active reports I would simply have a label on the header. AR has an event named format header. In this event I would set the caption of that label to the number I want on the report and that is what will print.
    Always use [code][/code] tags when posting code.

  5. #5
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,874

    Re: How to Create Auto Bill number in Data Report

    I've used a Rich Text Box to replace and insert it's fields into a RTF file. Here's the skeleton that gets fields, bold, italics, etc before it's printed.
    Attached Files Attached Files
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  6. #6
    Join Date
    Apr 2006
    Location
    Kolkata, India
    Posts
    273

    Re: How to Create Auto Bill number in Data Report

    Thank you Dglienna,
    Thank you very much for the guide lines.
    One more question:
    My Stock Datareport contains 4313 pages, when I click show Stock It shows only 1 (First) page there are no navigation controls or anything,but when I save It shows 4313 pages saved in .html format & literally there are all the pages showing.My question is how do I see the remaining pages of Datareport when the DataReport is displayed on the Screen?

    Thanking you
    Rahul

  7. #7
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,874

    Re: How to Create Auto Bill number in Data Report

    Easiest way is to save it automatically, then OPEN the html report! I don't use Data Reader. I created that file, and it prints out as many pages as are necessary. There are three OTHER reports in that program. VB6 doesn't make it easy to create reports.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  8. #8
    Join Date
    Apr 2006
    Location
    Kolkata, India
    Posts
    273

    Re: How to Create Auto Bill number in Data Report

    Dear dglienna,

    1)I tried your options to put a label in Datareport & control it through code, It miserably failed !!! a Message appeared you can not insert an automated object in this section.
    2) My program while trying to save data says " Out of Stack space" !!! what is the meaning of this.
    Please Help
    Thanks
    Rahul

  9. #9
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,874

    Re: How to Create Auto Bill number in Data Report

    If Bill #1 = Page #1, then just change the LABEL and use PAGE#
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  10. #10
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    4,782

    Re: How to Create Auto Bill number in Data Report

    I had a look at the report tool in vb to see what it supports compared to the one I use. I'm glad I do not have to use it. I created a new report added a label to the page header and then clicked on the page header to get the code window and checked what events were available. By default it goes to report error event. If I do the same thign with Active Reports by default it creates a stub for PageHeaderFormat, there are also events for BeforePrint and AfterPrint which can be used. So in active reports it is as simple as
    Code:
    Private Sub PageHeader_Format()
    Label1.Caption = MyReportID
    End Sub
    These events are available for every section of a report and allows you to modify any data, font, color as you like all through code just like if you were working with a VB Form object.

    I've switched to this tool back in VB5 from Crystal and fell in love with it the first day I used it so until now I had never looked at the VB report tool. Unfortunately Active Reports is a bit pricey but if you do a lot of coding that needs to create reports it is worth every penny and then some.
    Always use [code][/code] tags when posting code.

  11. #11
    Join Date
    Apr 2006
    Location
    Kolkata, India
    Posts
    273

    Re: How to Create Auto Bill number in Data Report

    Quote Originally Posted by DataMiser View Post
    I had a look at the report tool in vb to see what it supports compared to the one I use. I'm glad I do not have to use it. I created a new report added a label to the page header and then clicked on the page header to get the code window and checked what events were available. By default it goes to report error event. If I do the same thign with Active Reports by default it creates a stub for PageHeaderFormat, there are also events for BeforePrint and AfterPrint which can be used. So in active reports it is as simple as
    Code:
    Private Sub PageHeader_Format()
    Label1.Caption = MyReportID
    End Sub
    These events are available for every section of a report and allows you to modify any data, font, color as you like all through code just like if you were working with a VB Form object.

    I've switched to this tool back in VB5 from Crystal and fell in love with it the first day I used it so until now I had never looked at the VB report tool. Unfortunately Active Reports is a bit pricey but if you do a lot of coding that needs to create reports it is worth every penny and then some.
    Dear DataMiser,

    I am attaching the picture of the error,when I tried your code !!!

    Thanks
    Rahul
    Attached Images Attached Images  
    Last edited by dsrahul; July 24th, 2013 at 10:48 PM. Reason: pic sixe

  12. #12
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    4,782

    Re: How to Create Auto Bill number in Data Report

    You should have noticed that I said that was the code that would work in Active Reports. To the best of my knowledge VB report tool has no such event.

    The error you got is not related to the code I posted. It is telling you that you can not place a text box in that area. You will notice that I used a label in my code but again that code would not execute in Vb report tool due to the lack of the required event.
    Always use [code][/code] tags when posting code.

  13. #13
    Join Date
    Apr 2006
    Location
    Kolkata, India
    Posts
    273

    Re: How to Create Auto Bill number in Data Report

    Dear dglienna,

    No the bill no will be incremented every time a customers purchases something.
    Thanks
    Rahul

Tags for this Thread

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center