J
Jennie
I created a dialog box which prompts for criteria for a report. In Access 97,
I copied the code from the Developer Solutions sample database, everything
worked (so far anyway) with the exception of this code:
Private Sub Report_Open(Cancel As Integer)
' Create underlying recordset for report using criteria entered in
' RunReportByDate form.
Dim intX As Integer
Dim qdf As QueryDef
Dim frm As Form
' Don't open report if RunReportByDate form isn't loaded.
If Not (IsLoaded("RunReportByDate")) Then
Cancel = True
MsgBox "To preview or print this report, you must open " _
& "RunReportByDate in Form view.", vbExclamation, _
"Must Open Dialog Box"
Exit Sub
End If
' Set database variable to current database.
Set dbsReport = CurrentDb
Set frm = Forms!RunReportByDate
' Open QueryDef object.
Set qdf = dbsReport.QueryDefs("Cites")
qdf.Parameters("Forms!RunReportByDate!BeginningDate") _
= frm!BeginningDate
qdf.Parameters("Forms!RunReportByDate!EndingDate") _
= frm!EndingDate
' Open Recordset object.
Set rstReport = qdf.OpenRecordset()
' Set a variable to hold number of columns in crosstab query.
intColumnCount = rstReport.Fields.Count
End Sub
I keep getting a Run-Time Error 3265 - Item not found in this collection for
this statement - Set qdf = dbsReport.QueryDefs("Cites"). Anyone know what is
going on?
I copied the code from the Developer Solutions sample database, everything
worked (so far anyway) with the exception of this code:
Private Sub Report_Open(Cancel As Integer)
' Create underlying recordset for report using criteria entered in
' RunReportByDate form.
Dim intX As Integer
Dim qdf As QueryDef
Dim frm As Form
' Don't open report if RunReportByDate form isn't loaded.
If Not (IsLoaded("RunReportByDate")) Then
Cancel = True
MsgBox "To preview or print this report, you must open " _
& "RunReportByDate in Form view.", vbExclamation, _
"Must Open Dialog Box"
Exit Sub
End If
' Set database variable to current database.
Set dbsReport = CurrentDb
Set frm = Forms!RunReportByDate
' Open QueryDef object.
Set qdf = dbsReport.QueryDefs("Cites")
qdf.Parameters("Forms!RunReportByDate!BeginningDate") _
= frm!BeginningDate
qdf.Parameters("Forms!RunReportByDate!EndingDate") _
= frm!EndingDate
' Open Recordset object.
Set rstReport = qdf.OpenRecordset()
' Set a variable to hold number of columns in crosstab query.
intColumnCount = rstReport.Fields.Count
End Sub
I keep getting a Run-Time Error 3265 - Item not found in this collection for
this statement - Set qdf = dbsReport.QueryDefs("Cites"). Anyone know what is
going on?