Results 1 to 2 of 2

Thread: Problem with summary report - summing fields

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2006
    Posts
    184

    Problem with summary report - summing fields

    Ok, I have my report already completed with the design I want. I have tested the report as a Detail report only. My Select statement that populates the report was simply grabbing fields from the table and dropping them in the report.

    I saved my dataset schema and imported it to the report. I then tested my report with just my detail report select statement. The report worked fine. I then changed my Select statement to Sum the fields. For example

    Select Sum(Total), Sum(Price), Sum(Weight) From..............

    When I use this Select statement, my report errors out that the field name is not known. Like I said, it works fine until I change the select statement in the vb code. Is there a change I need to make to get this to work?

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Problem with summary report - summing fields

    The field name on the report must match a field name in the dataset. When you use an aggregate function in a sql statement you lose the original field name (names like Expr1, Expr2 are automatically assigned)

    Simply assign an Alias name to the fields in the sql statement.

    Select Sum(Total) As Total, Sum(Price) As Price, Sum(Weight) As Weight From..............

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