I have a report that uses unbound fields that are assigned at runtime. On open event assigns recordset... Code is below:
For some reason, when I export the report to either word or snapshot viewer, it only shows one month repeated with same data. The report shows rows of month and columns of year.
Any ideas what would cause the report to differ when exported? thanks!!!!
' Create underlying recordset for report using criteria entered in
' EmployeeSalesDialogBox form.
Dim intx As Integer
Dim qdf As QueryDef
Dim frm As Form
' Don't open report if frmOverviewRpts form isn't loaded.
If Not (IsLoaded("mainswitchboard")) Then
Cancel = True
MsgBox "To preview or print this report, you must open " _
& "main switchboard in Form view.", vbExclamation, _
"Must Open Dialog Box"
Exit Sub
End If
' Set database variable to current database.
Set dbsReport = CurrentDb
Set frm = Forms!mainswitchboard
' Open QueryDef object.
Set qdf = dbsReport.QueryDefs("qryHistoricalComparisonYearsFinalB")
' Set parameters for query based on values entered
' in EmployeeSalesDialogBox form.
qdf.Parameters("Forms!mainswitchboard!startDate") _
= frm!startdate
qdf.Parameters("Forms!mainswitchboard!ReportYear") _
= frm!ReportYear
qdf.Parameters("Forms!mainswitchboard!NorC") _
= frm!norc
' Open Recordset object.
Set rstReport = qdf.OpenRecordset()
' Set a variable to hold number of columns in crosstab query.
intcolumncount = rstReport.Fields.Count
For some reason, when I export the report to either word or snapshot viewer, it only shows one month repeated with same data. The report shows rows of month and columns of year.
Any ideas what would cause the report to differ when exported? thanks!!!!
' Create underlying recordset for report using criteria entered in
' EmployeeSalesDialogBox form.
Dim intx As Integer
Dim qdf As QueryDef
Dim frm As Form
' Don't open report if frmOverviewRpts form isn't loaded.
If Not (IsLoaded("mainswitchboard")) Then
Cancel = True
MsgBox "To preview or print this report, you must open " _
& "main switchboard in Form view.", vbExclamation, _
"Must Open Dialog Box"
Exit Sub
End If
' Set database variable to current database.
Set dbsReport = CurrentDb
Set frm = Forms!mainswitchboard
' Open QueryDef object.
Set qdf = dbsReport.QueryDefs("qryHistoricalComparisonYearsFinalB")
' Set parameters for query based on values entered
' in EmployeeSalesDialogBox form.
qdf.Parameters("Forms!mainswitchboard!startDate") _
= frm!startdate
qdf.Parameters("Forms!mainswitchboard!ReportYear") _
= frm!ReportYear
qdf.Parameters("Forms!mainswitchboard!NorC") _
= frm!norc
' Open Recordset object.
Set rstReport = qdf.OpenRecordset()
' Set a variable to hold number of columns in crosstab query.
intcolumncount = rstReport.Fields.Count