Hello everyone,
I am new to MS Access and i am using access 2007 for a report that outputs various fields based on the outcome of the query. I have no problem with that as i have used a report wizard and the various textboxes for the respective fields appear on the "details" section of the report. The challenge is, i want to display the totals of the displayed fields on the textboxes which i have manualy added (did not use wizard) on the "reportfooter" section.
To be more concise, qryBatchProfile is a query that updates the report with the fields on the details section when a command button cmd_Preview is clicked. Then the second query, qryTotals is suposed to compute sums per field in qrybatchProfile and update the textboxes on the "reportfooter" section.
Now, when i click the command button to preview the report i get a dialog that requires me to enter the parameter value of qryTotals before the report is displayed. I understand that i have to set the recordsouce of my report to the two queries but the data tab on the property sheet is blank.this is the my code.
Private Sub cmdPreview_Click()
On Error GoTo Err_cmdPreview_Click
Dim stDocName As String
'
stDocName = "qryBatchProfile"
DoCmd.OpenQuery stDocName, , acEdit
stDocName = "qryTotals"
DoCmd.OpenQuery stDocName, , acEdit
'Me.Text27.Value = DCount("B_T", "Sum Of Blend Target(kg)")
'
stDocName = "rptProfileData"
DoCmd.OpenReport stDocName, acPreview
Exit_cmdPreview:
Exit Sub
Err_cmdPreview:
MsgBox Err.Description
Resume Exit_cmdPreview_Click
End Sub