Windows 7 - Print button on Report form

Asked By Jan :\) on 17-Jan-10 03:39 PM
Hi all :-) =20
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. =20
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. =20

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. =20

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 =3D "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:
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.=20

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

Dim stDocName As String
Dim MyForm As Form

stDocName =3D "frmMisc"
Set MyForm =3D 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=20
*******************End Code**************************

Any help would be very much appreciated.

Jan :)




Larry Linson replied to Jan :\) on 17-Jan-10 03:52 PM
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 would  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:
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 am 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 :)
Jan :\) replied to Larry Linson on 17-Jan-10 06:15 PM
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 do not 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.=20

Jan :)  =20

and it=20
interface"=20
reports",=20
can=20
can=20
trying to=20
limit the=20
as=20
report=20
but,=20
form in=20
the QAT=20
will=20
not=20
report,=20
Object Name=20
else,=20
rather=20
Jan :\) replied to Jan :\) on 18-Jan-10 03:13 PM
Please disregard, I have been able to get the code figured out.  The =
button is working as it should.

Jan :)


Hi all :-) =20
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. =20
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. =20

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. =20

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 =3D "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:
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.=20

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

Dim stDocName As String
Dim MyForm As Form

stDocName =3D "frmMisc"
Set MyForm =3D 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=20
*******************End Code**************************

Any help would be very much appreciated.

Jan :)