thmsjlmnt3953
Registered User.
- Local time
- Today, 01:03
- Joined
- May 20, 2014
- Messages
- 120
Hi,
I'm using the following code on_open of a report which works fine in another DB however when using it here i get the above error.
I've also attached an image of the query and parameters set up for this.

any help would be fantastic.
I'm using the following code on_open of a report which works fine in another DB however when using it here i get the above error.
Code:
Private Sub Report_Open(Cancel As Integer)
' 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 EmployeeSalesDialogBox form isn't loaded.
'If Not (IsLoaded("EmployeeSalesDialogBox")) Then
' Cancel = True
' MsgBox "To preview or print this report, you must open " _
' & "EmployeeSalesDialogBox in Form view.", vbExclamation, _
' "Must Open Dialog Box"
' Exit Sub
'End If
' Set database variable to current database.
Set dbsReport = CurrentDb
Set frm = Forms!frmnavigation!NavigationSubform.Form
' Open QueryDef object.
' Set qdf = dbsReport.QueryDefs("EmployeeSales")
Set qdf = dbsReport.QueryDefs(Me.RecordSource)
' Set parameters for query based on values entered
' in EmployeeSalesDialogBox form.
qdf.Parameters("Forms!frmnavigation!NavigationSubform!BeginningDate") _
= frm!beginningdate
qdf.Parameters("Forms!frmnavigation!NavigationSubform!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
I've also attached an image of the query and parameters set up for this.

any help would be fantastic.