Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error When Total Report 2

Status
Not open for further replies.

0212

Technical User
Apr 2, 2003
115
US
Hi, all! Hope you can help! I tried to total a column in my report and I received "#error" in the textbox. I used

=Sum([BudgTot]) in a textbox in the footer of the report. I did the exact thing to total a form (form and report look exactly the same) and it worked beautifully. The report is called from the form using a command button on the form.
Here is the code attached to the command button:

Private Sub Print_Report_Click()
On Error GoTo Err_Print_Report_Click

Dim stDocName As String
Dim PrintDoc As Integer

stDocName = "RptFRM_3_8_2007_Budget_Form"
DoCmd.OpenReport stDocName, acPreview
PrintDoc = MsgBox("Print Report?", vbYesNo + vbDefaultButton1)
If PrintDoc = 6 Then
DoCmd.PrintOut
End If

Exit_Print_Report_Click:
Exit Sub

Err_Print_Report_Click:
MsgBox Err.Description
Resume Exit_Print_Report_Click


When the report is opened I used all the information contained in the form (see code below)to generate the report:

Private Sub Report_Open(Cancel As Integer)
Me.FilterOn = True
Me.Filter = Forms!FRM_3_8_2007_Budget_Form.Filter
Me.OrderByOn = True
Me.OrderBy = Forms!FRM_3_8_2007_Budget_Form.OrderBy
'Me!TDollars = Forms!FRM_3_8_2007_Budget_Form.TDollars
'Me!TRptType = Forms!FRM_3_8_2007_Budget_Form.TRptType
End Sub

Any ideas?
 
Does the form remain open while you are running your report?
 
Did you place =Sum([BudgTot]) in the Report Footer or the Page Footer? Is BudgTot a numeric field in your report's record source?

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thanks, for your responses!

Remou, the form remains open since the report obtains info from the form's fields.

dhookom, I put the textbox w/formula in the page footer. BudgTot is a numeric field placed in the report's record source.

I know it's a bit complicated - I hope the solution is simple! Thanks for your help!
 
Page footer is not suitable for a sum. You can use Group Footers or the Report Footer.
 
Or, you can put aggregates in Group or Report Headers as well as the Footers. It's just the Page sections that don't behave with Sum(), Avg(),...

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thank you, Remou and dhookum!! I put the text box in the report footer. I am still learning Access's quirks. Take care!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top