I originally used a button on a from created via the button wizard (access 2007) to run my report which was based on a query.
Since I wanted to add some validation I removed the button and added my own
code (as below):-
However the open report is just a preview and the user cant exit the preview
screen without directly using access controls.
I cant use the DoCmd.RunReport method :-(
I want to create report output and then use buttons on the report output
allowing for more user navigation and functions.
How do I run reports and allow the screen to include the actual report
output with workable buttons etc.., as per available in the macros assigned using button wizard ?
Hope this makes sense.
Thanks Rob
Expand|Select|Wrap|Line Numbers
- 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", acViewPreview
- ' 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