Results 1 to 6 of 6

Thread: Calculate and display total in report

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2017
    Posts
    3

    Calculate and display total in report

    How to display total for a field in a report?

  2. #2
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: Calculate and display total in report

    Hi Mani,

    I see that you're new ... so ... welcome to VBForums.

    However, you've got to provide more details about what you want before we're able to help you.

    • Are these items to be totaled coming out of some recordset?
    • If it's a recordset, what technology is being used to access it, ADO, RDO, DAO, something else?
    • When you say "report", what do you mean? Crystal reports? Automation to Word or Excel? Roll-your-own with Printer object? Something else?


    Also, can you show us what attempts you've made? That would go a long way toward helping us to understand some of the above questions. Also, please take some time to learn how to use these forums (such as the # button for encapsulating code you post).

    Mani, it is a but frustrating for us (or, at least for me) when I see at post like this. Many of us here enjoy helping people to get their programming done, but we do need some minimum of information.

    Good Luck with It,
    Elroy
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  3. #3
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: Calculate and display total in report

    I do not use the built in VB report tool but in the one I do use and most others there is a setting to give you a total. For example in the tool I use you would place the field on the report, map it to the data field you want the total of then set the properties to sum and running total for group or perhaps in all depending on if you need a sub total for a group or a grand total for everything.

    Like I say though I do not use the built in report tool so no idea how much functionality it offers in this regard or how to set it up

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Calculate and display total in report

    When in doubt try reading the manual:

    Adding a Function Control to the Data Report

  5. #5
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: Calculate and display total in report

    Great link

  6. #6

    Thread Starter
    New Member
    Join Date
    Oct 2017
    Posts
    3

    Re: Calculate and display total in report

    1.I am doing a project on billing. In the bill, I need to add the records displayed in the bill. I am doing it in vb6.

    Code:
    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset
    
    Set cn = New ADODB.Connection
    Set rs = New ADODB.Recordset
    cn.CursorLocation = adUseClient
    
    cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\mani\stock.mdb;Persist Security Info=False"
    
    rs.Open "select * from bill", cn, adOpenStatic, adLockBatchOptimistic
    
    DataEnvironment1.Command2 (billnotxt.Text)
    
    DataReport1.show
    Unload bill_cur_date
    Unload bill_no
    Unload home_page
    
    rs.Close
    cn.Close
    Set rs = Nothing
    Set cn = Nothing
    2. I am using ADO

    3. This is my report's snap shot

    Name:  report.jpg
Views: 282
Size:  46.1 KB

    In this report i should calculate and show the result in label 35.

    I am sorry i will correct myself. Thank you for answering my post.

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