Running Reports

R

Rob W

Greetings,

I originally used a button on a from created via the button wizard 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 with 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.

How do I run reports and allow the screen to include the actual report
output with workable buttons etc..,?
Hope this makes sense.

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", 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
 
R

Rob W

I should add using DoCmd.RunReport "rptStudentClassification" gave the
message

"Compile Error: Method or data member not found" though this code works:-

DoCmd.OpenReport "rptStudentClassification", acViewPreview

Indicating the report is fine.
 
J

John W. Vinson

Greetings,

I originally used a button on a from created via the button wizard 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 with 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.

How do I run reports and allow the screen to include the actual report
output with workable buttons etc..,?
Hope this makes sense.

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", acViewPreview

There is no RunReport method. The OpenReport method is what you want.
acViewPreview opens the report in preview mode; if you change it to
acViewNormal it will print to your default printer.

I have no idea what "actual report output with workable buttons" might be...
how would you get to this normally???
 
R

Rob W

In access 2007 using the button wizard you can assign a report to run it
upon click event (macro).

Rather than seeing the preview window with magnifying glass you see the
report output.
Within the report layout you can add buttons to it and assign code.

The buttons on my report can be seen using openreport, but as its in preview
mode they cant be clicked.

Hope this make sense
Rob
 
J

John W. Vinson

In access 2007 using the button wizard you can assign a report to run it
upon click event (macro).

Rather than seeing the preview window with magnifying glass you see the
report output.
Within the report layout you can add buttons to it and assign code.

The buttons on my report can be seen using openreport, but as its in preview
mode they cant be clicked.

ah... sorry about that! I have not yet installed 2007 (my clients are all
sticking with 2003 for now) and was not aware of the new feature. Perhaps you
should start a new thread (indicating the version)...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top