Hi
I'm trying to pass a reports record source and input parameters via vba as
I have a problem with my reports in my adp project that require parameters from forms.
It works fine under my user account but for my users from what I've read adp projects do not append the correct record source qualifier of dbo and instead append the username.queryname (basically it works for the sysadmin but not for any of my users which is hence useless, as it kicks an error 'the record source for this object dbo.query name does not exists'
so I have my form all setup and on the buttons on click event I have the following. But keep getting error 'the report name "RPT Jobs by Customer" you entered is either misspelled or refers to a report that isn't open or doesn't exist'
.. my question is can anyone point me in the right direction to solve this one???
thanks Nathan
Private Sub Command23_Click()
On Error GoTo Err_Command23_Click
Dim rpt As Report
Set rpt = Access.Application.Reports("RPT Jobs by Customer")
DoCmd.OpenReport rpt, acViewDesign
rpt.RecordSource = "EXEC dbo.[RPT Jobs by Customer]"
rpt.InputParameters = _
" @Company datetime=" & Forms![RPT Customer Criteria]!Company & " , " & _
" @StartDate datetime=" & Forms![RPT Customer Criteria]!SD & " , " & _
" @EndDate datetime=" & Forms![RPT Customer Criteria]!ED
DoCmd.OpenReport rpt, acViewPreview
Me.Visible = False
Exit_Command23_Click:
Exit Sub
Err_Command23_Click:
MsgBox Err.Description
Resume Exit_Command23_Click
End Sub
I'm trying to pass a reports record source and input parameters via vba as
I have a problem with my reports in my adp project that require parameters from forms.
It works fine under my user account but for my users from what I've read adp projects do not append the correct record source qualifier of dbo and instead append the username.queryname (basically it works for the sysadmin but not for any of my users which is hence useless, as it kicks an error 'the record source for this object dbo.query name does not exists'
so I have my form all setup and on the buttons on click event I have the following. But keep getting error 'the report name "RPT Jobs by Customer" you entered is either misspelled or refers to a report that isn't open or doesn't exist'
.. my question is can anyone point me in the right direction to solve this one???
thanks Nathan
Private Sub Command23_Click()
On Error GoTo Err_Command23_Click
Dim rpt As Report
Set rpt = Access.Application.Reports("RPT Jobs by Customer")
DoCmd.OpenReport rpt, acViewDesign
rpt.RecordSource = "EXEC dbo.[RPT Jobs by Customer]"
rpt.InputParameters = _
" @Company datetime=" & Forms![RPT Customer Criteria]!Company & " , " & _
" @StartDate datetime=" & Forms![RPT Customer Criteria]!SD & " , " & _
" @EndDate datetime=" & Forms![RPT Customer Criteria]!ED
DoCmd.OpenReport rpt, acViewPreview
Me.Visible = False
Exit_Command23_Click:
Exit Sub
Err_Command23_Click:
MsgBox Err.Description
Resume Exit_Command23_Click
End Sub