R
Rob W
Greetings,
I initially used the button wizard to assign a macro to run my access report
on my run report form.
Within my report I had a button to allow the user to print the report and
close the report to be returned back to the run report form.
As I wanted to checked if the report was empty or not before running, I
removed the button created by the wizard and manually did one and assigned
the following vba code to it (see below)
However I can now only get my report to OPEN in preview mode, rendering all
button inopertable as you can't access it and have to use access controls to
exit the preview mode. You can see buttons on the report just cant access
them.
How can I get the report to be generated and allow button interactivity?
Hope this makes sense, let me know if I need to clarify more.
Thanks
Rob
Private Sub cmdopenreport_Enter()
On Error GoTo Report_NoData_Error
If IsNull(cboStudentid) Then
MsgBox "Please choose a student Id", vbCritical
cboStudentid.SetFocus
Else
DoCmd.OpenReport "rptStudentClassification", acPreview
'Results in error cant find command RunReport !!!!
' DoCmd.RunReport "rptStudentClassification"
End If
Report_NoData_Exit:
Exit Sub
Report_NoData_Error:
If Err.Number = 2501 Then 'the report was cancelled
Exit Sub
Else
MsgBox Err.Number & " - " & Err.Description
Resume Report_NoData_Exit
End If
End Sub
I initially used the button wizard to assign a macro to run my access report
on my run report form.
Within my report I had a button to allow the user to print the report and
close the report to be returned back to the run report form.
As I wanted to checked if the report was empty or not before running, I
removed the button created by the wizard and manually did one and assigned
the following vba code to it (see below)
However I can now only get my report to OPEN in preview mode, rendering all
button inopertable as you can't access it and have to use access controls to
exit the preview mode. You can see buttons on the report just cant access
them.
How can I get the report to be generated and allow button interactivity?
Hope this makes sense, let me know if I need to clarify more.
Thanks
Rob
Private Sub cmdopenreport_Enter()
On Error GoTo Report_NoData_Error
If IsNull(cboStudentid) Then
MsgBox "Please choose a student Id", vbCritical
cboStudentid.SetFocus
Else
DoCmd.OpenReport "rptStudentClassification", acPreview
'Results in error cant find command RunReport !!!!
' DoCmd.RunReport "rptStudentClassification"
End If
Report_NoData_Exit:
Exit Sub
Report_NoData_Error:
If Err.Number = 2501 Then 'the report was cancelled
Exit Sub
Else
MsgBox Err.Number & " - " & Err.Description
Resume Report_NoData_Exit
End If
End Sub