|
-
Feb 28th, 2007, 12:45 PM
#1
Thread Starter
Addicted Member
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?
-
Feb 28th, 2007, 02:41 PM
#2
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|