Print button on Report form

  • Thread starter Thread starter Jan :\)
  • Start date Start date
J

Jan :\)

Hi all :-)
Access 2007 Pro Plus, Vista Ultimate SP2

I am preparing a small app for a friend who is handicapped, and am trying to make things as simple as possible for them to use. I am trying to limit the number of functions and clicks necessary to accomplish tasks as much as possible, and would like to try an idea.

I want to add a small button on the report form that will print the report when clicked. I have done this on display forms to print as a report, but, not on a report form. In trying to add such a button to the report form in 2007 I am not being offered the option for any functions, such as Report>Print, for the command button.
I know that I can add the Quick Print icon to the QAT in 2007, but, the QAT is not available in 2003 or prior versions, so I have to create such functions in a manner that can be used in older versions.

I am looking for a bit of code that I can put behind the button that will print the report. I have been trying to get it set up, but, so far am not winning.

Here is the code that I have tried behind the print button on the report, which I have set to display on screen only,
*******************Start Code********************
Private Sub cmdPrint_Click()
On Error GoTo Err_cmdPrint_Click

Dim stDocName As String
Dim MyForm As Form

stDocName = "rptMisc"
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False

Exit_cmdPrint_Click:
Exit Sub

Err_cmdPrint_Click:
MsgBox Err.Description
Resume Exit_cmdPrint_Click
End Sub
***************End Code********************

When I try to print I get the following error message:
"Miscosoft Office Access can't find the rptMisc you reference in Object Name argument."

I have print buttons working on the display forms ok, and if nothing else, they can print out the display form as a report. But, I would really rather that they have the report to print out.

Here is the code behind the Print button for the display forms, which are set to display on screen only. I'm not sure this is the best code set up for this either, although, it does print out as it should.
**********Start Code*************************************
Private Sub Command8_Click()
On Error GoTo Err_Command8_Click

Dim stDocName As String
Dim MyForm As Form

stDocName = "frmMisc"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False

Exit_Command8_Click:
Exit Sub

Err_Command8_Click:
MsgBox Err.Description
Resume Exit_Command8_Click
End Sub
*******************End Code**************************

Any help would be very much appreciated.

Jan :)
 
It is by design that the user interface was changed with Access 2007, and it
is by design that no provision was included to use a "classic interface"
instead of the new one. As previous versions have no "interactive reports",
you'd have to write to accomodate the previous versions and see if you can
find a way to make that work with the newer versions.

Perhaps someone who develops in Access 2007 for backward compatibility can
offer you some useful suggestions.

Larry Linson
Microsoft Office Access MVP

Hi all :-)
Access 2007 Pro Plus, Vista Ultimate SP2

I am preparing a small app for a friend who is handicapped, and am trying to
make things as simple as possible for them to use. I am trying to limit the
number of functions and clicks necessary to accomplish tasks as much as
possible, and would like to try an idea.

I want to add a small button on the report form that will print the report
when clicked. I have done this on display forms to print as a report, but,
not on a report form. In trying to add such a button to the report form in
2007 I am not being offered the option for any functions, such as
Report>Print, for the command button.
I know that I can add the Quick Print icon to the QAT in 2007, but, the QAT
is not available in 2003 or prior versions, so I have to create such
functions in a manner that can be used in older versions.

I am looking for a bit of code that I can put behind the button that will
print the report. I have been trying to get it set up, but, so far am not
winning.

Here is the code that I have tried behind the print button on the report,
which I have set to display on screen only,
*******************Start Code********************
Private Sub cmdPrint_Click()
On Error GoTo Err_cmdPrint_Click

Dim stDocName As String
Dim MyForm As Form

stDocName = "rptMisc"
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False

Exit_cmdPrint_Click:
Exit Sub

Err_cmdPrint_Click:
MsgBox Err.Description
Resume Exit_cmdPrint_Click
End Sub
***************End Code********************

When I try to print I get the following error message:
"Miscosoft Office Access can't find the rptMisc you reference in Object Name
argument."

I have print buttons working on the display forms ok, and if nothing else,
they can print out the display form as a report. But, I would really rather
that they have the report to print out.

Here is the code behind the Print button for the display forms, which are
set to display on screen only. I'm not sure this is the best code set up
for this either, although, it does print out as it should.
**********Start Code*************************************
Private Sub Command8_Click()
On Error GoTo Err_Command8_Click

Dim stDocName As String
Dim MyForm As Form

stDocName = "frmMisc"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False

Exit_Command8_Click:
Exit Sub

Err_Command8_Click:
MsgBox Err.Description
Resume Exit_Command8_Click
End Sub
*******************End Code**************************

Any help would be very much appreciated.

Jan :)
 
Hi Larry! :-)

Thanks for the information on the changes that I was not aware of. I had not tried this sort of thing in the 2007 so was not sure if it was me or something else. I don't normally do such, but, I work with folks with physical and/or learning special needs, and I try to do what I can to make things as simple and convenient for them as possible. For some, each mouse click takes a lot of effort, and keyboard shortcuts are just not doable for some. So, I thought I would try it and see how it would work out for my friend. I could install the 2003 on another machine and add the button that way, but, if possible, I would like to be able to do it in 2007, so if someone else needs the same accommodation that only has 2007 it would work for them too.

Jan :)
 
Please disregard, I have been able to get the code figured out. The button is working as it should.

Jan :)


Hi all :-)
Access 2007 Pro Plus, Vista Ultimate SP2

I am preparing a small app for a friend who is handicapped, and am trying to make things as simple as possible for them to use. I am trying to limit the number of functions and clicks necessary to accomplish tasks as much as possible, and would like to try an idea.

I want to add a small button on the report form that will print the report when clicked. I have done this on display forms to print as a report, but, not on a report form. In trying to add such a button to the report form in 2007 I am not being offered the option for any functions, such as Report>Print, for the command button.
I know that I can add the Quick Print icon to the QAT in 2007, but, the QAT is not available in 2003 or prior versions, so I have to create such functions in a manner that can be used in older versions.

I am looking for a bit of code that I can put behind the button that will print the report. I have been trying to get it set up, but, so far am not winning.

Here is the code that I have tried behind the print button on the report, which I have set to display on screen only,
*******************Start Code********************
Private Sub cmdPrint_Click()
On Error GoTo Err_cmdPrint_Click

Dim stDocName As String
Dim MyForm As Form

stDocName = "rptMisc"
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False

Exit_cmdPrint_Click:
Exit Sub

Err_cmdPrint_Click:
MsgBox Err.Description
Resume Exit_cmdPrint_Click
End Sub
***************End Code********************

When I try to print I get the following error message:
"Miscosoft Office Access can't find the rptMisc you reference in Object Name argument."

I have print buttons working on the display forms ok, and if nothing else, they can print out the display form as a report. But, I would really rather that they have the report to print out.

Here is the code behind the Print button for the display forms, which are set to display on screen only. I'm not sure this is the best code set up for this either, although, it does print out as it should.
**********Start Code*************************************
Private Sub Command8_Click()
On Error GoTo Err_Command8_Click

Dim stDocName As String
Dim MyForm As Form

stDocName = "frmMisc"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False

Exit_Command8_Click:
Exit Sub

Err_Command8_Click:
MsgBox Err.Description
Resume Exit_Command8_Click
End Sub
*******************End Code**************************

Any help would be very much appreciated.

Jan :)
 
Back
Top