Print button on Report form

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

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.=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 :) 
0
Jan
1/17/2010 8:39:56 PM
access.forms 6864 articles. 2 followers. Follow

3 Replies
2620 Views

Similar Articles

[PageSpeed] 26

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

"Jan :)" <abuse@localhost.invalid> wrote in message 
news:eoqiRV7lKHA.1648@TK2MSFTNGP05.phx.gbl...
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 :) 



0
Larry
1/17/2010 8:52:42 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 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.=20

Jan :)  =20

"Larry Linson" <bouncer@localhost.not> wrote in message =
news:O4C4%23b7lKHA.3792@TK2MSFTNGP02.phx.gbl...
> It is by design that the user interface was changed with Access 2007, =
and it=20
> is by design that no provision was included to use a "classic =
interface"=20
> instead of the new one. As previous versions have no "interactive =
reports",=20
> you'd have to write to accomodate the previous versions and see if you =
can=20
> find a way to make that work with the newer versions.
>=20
> Perhaps someone who develops in Access 2007 for backward compatibility =
can=20
> offer you some useful suggestions.
>=20
> Larry Linson
> Microsoft Office Access MVP
>=20
> "Jan :)" <abuse@localhost.invalid> wrote in message=20
> news:eoqiRV7lKHA.1648@TK2MSFTNGP05.phx.gbl...
> Hi all :-)
> Access 2007 Pro Plus, Vista Ultimate SP2
>=20
> I am preparing a small app for a friend who is handicapped, and am =
trying to=20
> make things as simple as possible for them to use. I am trying to =
limit the=20
> number of functions and clicks necessary to accomplish tasks as much =
as=20
> possible, and would like to try an idea.
>=20
> I want to add a small button on the report form that will print the =
report=20
> when clicked.  I have done this on display forms to print as a report, =
but,=20
> not on a report form. In trying to add such a button to the report =
form in=20
> 2007 I am not being offered the option for any functions, such as=20
> Report>Print, for the command button.
> I know that I can add the Quick Print icon to the QAT in 2007, but, =
the QAT=20
> is not available in 2003 or prior versions, so I have to create such=20
> 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=20
> print the report. I have been trying to get it set up, but, so far am =
not=20
> winning.
>=20
> Here is the code that I have tried behind the print button on the =
report,=20
> which I have set to display on screen only,
> *******************Start Code********************
> Private Sub cmdPrint_Click()
> On Error GoTo Err_cmdPrint_Click
>=20
>    Dim stDocName As String
>    Dim MyForm As Form
>=20
>    stDocName =3D "rptMisc"
>    DoCmd.SelectObject acForm, stDocName, True
>    DoCmd.PrintOut
>    DoCmd.SelectObject acForm, MyForm.Name, False
>=20
> Exit_cmdPrint_Click:
>    Exit Sub
>=20
> Err_cmdPrint_Click:
>    MsgBox Err.Description
>    Resume Exit_cmdPrint_Click
> End Sub
> ***************End Code********************
>=20
> When I try to print I get the following error message:
> "Miscosoft Office Access can't find the rptMisc you reference in =
Object Name=20
> argument."
>=20
> I have print buttons working on the display forms ok, and if nothing =
else,=20
> they can print out the display form as a report. But, I would really =
rather=20
> that they have the report to print out.
>=20
> Here is the code behind the Print button for the display forms, which =
are=20
> set to display on screen only.  I'm not sure this is the best code set =
up=20
> for this either, although, it does print out as it should.
> **********Start Code*************************************
> Private Sub Command8_Click()
> On Error GoTo Err_Command8_Click
>=20
>    Dim stDocName As String
>    Dim MyForm As Form
>=20
>    stDocName =3D "frmMisc"
>    Set MyForm =3D Screen.ActiveForm
>    DoCmd.SelectObject acForm, stDocName, True
>    DoCmd.PrintOut
>    DoCmd.SelectObject acForm, MyForm.Name, False
>=20
> Exit_Command8_Click:
>    Exit Sub
>=20
> Err_Command8_Click:
>    MsgBox Err.Description
>    Resume Exit_Command8_Click
> End Sub
> *******************End Code**************************
>=20
> Any help would be very much appreciated.
>=20
> Jan :)=20
>=20
>=20
>
0
Jan
1/17/2010 11:15:01 PM
Please disregard, I have been able to get the code figured out.  The =
button is working as it should.

Jan :)


"Jan :)" <abuse@localhost.invalid> wrote in message =
news:eoqiRV7lKHA.1648@TK2MSFTNGP05.phx.gbl...
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:
"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.=20

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.=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 :)
0
Jan
1/18/2010 8:13:05 PM
Reply:

Similar Artilces:

Can I copy radio buttons so that the second set is independent of.
I have a group of four radio buttons that all point to one cell. My goal is to create a second set that looks identical to the first but which points to a second cell. This is for a questionaire that will have many questions with the same four answer values. I want to be able to quickly create 100 button groups that will each update a separate cell for scoring of the questionaire. There are optionbuttons on the Control toolbox toolbar and there are optionbuttons on the Forms toolbar. Each has different behaviors. If I had to use lots, I'd use the Forms version. Here's a pos...

Reporting IRA distributions
I have an IRA account with corresponding cash account. I am trying to get the distribution from the IRA to show up as "Retirement Income" in the Tax-Related Transactions report. How to do it? The distributions are handled as a transfer from the IRA Investment cash acct to a checking account. Thanks for any help. Money 99, BTW. Do I need to upgrade to a later version? ...

Can't create Organizational Forms Library in Exchange 2003 with SP
Hello, I cannot create an Organizational Form in EFORMS REGISTRY folder (from First Administrative Group->Folders->Public Folders->EFORMS REGISTRY in ESM). When I right-click the EFORMS REGISTRY folder and select New, there is no Organization Form. Instead, I only see Public Folder in the popup menu. Do you have any idea why Organizational Form menu does not show? My Exchange Server is Exchange 2003 with SP2. The login user is Administrator. Could you please help me? Thank you very much. Yang Is that account member of "Enterprise Admins" group? Yang Zhang wrote: &...

Pass parameter from FORM to QUERY
I have an append query that I trying to call from a cmd btn...but it prompts me for the parameter(ie QuoteID)... How do I tye it into my call: Dim stQueName As String stQueName = "Quote Query" DoCmd.OpenQuery stQueName, acNormal, acEdit On Apr 13, 12:56 pm, jlt...@hotmail.com wrote: > I have an append query that I trying to call from a cmd btn...but it > prompts me for the parameter(ie QuoteID)... > How do I tye it into my call: > > Dim stQueName As String > stQueName = "Quote Query" > DoCmd.OpenQuery stQueName, acNormal, acEd...

Office 2007 forms
I am creating a form with office 2007, will those people who do not use office 2007 be able to fill in my form? should I save it in a particular format? thanks Provided you start from the normal template, don't use fonts that were introduced with Word 2007, and save the form in Word 97-2003 document format, anyone with Word 97 or later should be able to open it. Use only the legacy form fields, to which end http://gregmaxey.mvps.org/Classic%20Form%20Controls.htm will make things easier. -- <>>< ><<> ><<> <>>< ><<...

Printing In Color
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) I am trying to print a document in word that is color but it is only coming out in black and white. How can I change the color settings on my printer? Word has no setting to print in color v. B/W -- that's a function of your printer & its driver software. The settings are available in the Print dialog in the Copies & Pages List, but exactly where the setting is located depends to a great extent on what printer you have. Some printers also have physical controls on the printer, itself, but that isn't common. ...

Problem with macro assigned to custom toolbar button
Problem with macro assigned to custom toolbar button I am having a probelm with macros assigned to a custom button on custom button. I am using excel 2000. 1. I have created a macro called "Jump" in a workbook named "Test1" 2. I then created a custom toolbar and added a custom toolbar button t that toolbar. 3. Through the customize dialog box I assign the Macro "Jump" to th custom button. Everything works fine UNTIL. If I do a SAVE AS for the workbook "Test1" and call it something els like "Test2" and then close "Test2" an...

How to track ActiveControl.Name when switching records in form with multiple subforms
I need to have a global variable always contain the name of the current form field. This bit of code is attached to the GotFocus event of all fields and the Enter event of all subforms: gxCurrentField = Me.ActiveControl.Name However it doesn't work properly when changing records in a subform. My parent form contains two subforms in a many-to-many relationship. The above variable usually ends up containing the name of the first field in the second subform when switching records in the first subform. How to correctly code this? Or is there some native variable I'm not aware of? I...

set print area #2
Where is the "set print area" button in Excel 2002 that was in Excel '97? =?Utf-8?B?Q2Fyb2wgTWM=?= wrote > Where is the "set print area" button in Excel 2002 that was in Excel '97? > Are you sure it was "standard"? Only way I could get in was to right-click the toolbar|Customise and drag it to the toolbar from Commands|File -- David ...

Outlook 2003
In Outlook 2003, #1 Is there a way to refresh the unread folder so that read messages no longer apear? Right now I have to click closed the unread folder and click it again #2 Is there a way to create a toolbar button that goes directly to a subfolder? Thanks ...

cursor missing from form textboxes
I believe that I know 98% of the little intricacies of Publisher, but I'm stumped on this one. I created a website with a contact page and none of the standard textboxes will show a cursor to indicate with field you are in (I've even made the site live to double check). If you tab between textboxes, the tabbing works, as does typing, there is just no visual cursor to indicate where you are. If you click on the first textbox and type, all is good you can tab to the next box and type, and it's fine. I'd like to have the visual cursor show and can't get it. I also have ...

Report Can Grow not aligned horizontally
I have a report where I have 1 row of text, memo, number, and date fields. The memo field can contain up to 4-5 lines of wrapped text. I have set all teh rows to "can grow". However, on my report, the conditional formatting doesn't grow. For instance, the fill (which I have set to a gray color) in the memo field is about 3 lines deep when there is a lot of text in the memo field, but the text and number fields associated with that record are actually only 1 line. This essentially looks like a mess, small gray filled boxes for the text fields and a large gray ...

Why will my publisher 2003 not print graphics?
I have recently loaded windows 7, and since then I cannot print any graphics from any publisher document, text and infills print but lines do not! I have looked at the advance printer settings and the "Do not print any graphics" box is not ticked. I have also tried reloading publisher but this did nothing. Any ideas anyone? Might take a look at the web site of your printer model to see if there are Windows 7 drivers. Will the document print okay if you convert it to PDF? There are free converters around. www.primopdf.com is free. It is always wise to completely remove ...

Custom reports #3
Hi, I want to pull a report on how many customers I am getting every hour of the day. Does anyone out there know how to do that? I can try writing a query if someone can tell me which table I can find this information in (timestamp, transaction etc). Any help is appreciated. Regards JD This info is given at the end of the Z report. If you want to use it in a query open the Z report recipt file using the Notepad and see the fields that are used... Report.Hour.HourSales etc... Hope this helps... Carlos "JD" wrote: > Hi, > > I want to pull a report on how many cust...

How can I print on 8 1/2"x17" paper?
I have cut down an 11x17 paper to 8 1/2" x 17". I cannot figure out how to change the paper size to accept and print anything bigger than 14." any suggestions would be greatly appreciated First make the size settings in the Printer Setup. You may need to use the Custom selection. -- Don Vancouver, USA "mickilena" <mickilena@discussions.microsoft.com> wrote in message news:1AD99AFE-7FE7-4A07-9D20-1B1AFF9856BD@microsoft.com... >I have cut down an 11x17 paper to 8 1/2" x 17". I cannot figure out how to > change the paper size to accept a...

VBA form
Im using a form/macro that i linked to through another thread and a tailoring it to my needs. I basically have it doing what i need but cant get a button to do what i want. When the user starts the macro i brings up the form with a message and 2 buttons (Continue/Cancel). Whe continue is pressed i want the message on the form to change to aniothe message and so on until all messages are shown. Ive attacehed what i working on and apprecaite any help offered. Thank yo +------------------------------------------------------------------- |Filename: Excel.zip ...

how to run onhand value report
I get the message enter parameter when entering the zoom feature On Sat, 6 Mar 2010 17:36:01 -0800, junebugg <junebugg@discussions.microsoft.com> wrote: >I get the message enter parameter when entering the zoom feature You'll have to give us some more context than that, junebugg. What's the "onhand value report"? What's the "zoom feature"? You can see your database; we cannot! -- John W. Vinson [MVP] ...

Fulfillment type orders
We have orders at the initial status (just entered) and the options to allow delete documents and void documents are enabled on the Sales Order Type. However, we can't get a void or delete button unless we move the fulfillment order through the confirm process to an "Invoice" to get a Delete? What's up with this? Very annoying. Jana, I know it is subtle and wish there was a better way to display it, but the Void option only applies to Invoice type IDs and not Fulfillment Order type IDs ("Void Invoice Documents" vs. "Delete Documents"). Since both t...

Scroll Wheel effecting a form
Is there any way to keep a mouse scroll wheel from having an effect on a form? This is a single form for data entry and if are part way thru the form and for what ever reasom use the scroll wheel all the fields on the form are effected (they dissapear - like going to the next new record). My suggestion to get a mouse without a scrool wheel was not met with enthusiasm. :) Any help here will be appreciated. Thanks in advance The scroll wheel is moving you through the records. Nothing except your view of the records is disappearing. The records are still there. I wouldn't think y...

Print preview distorts objects
I have an XL2000 worksheet that has 4 controls on it (one command button, and 3 radio buttons). When I print preview the worksheet, once I close the print preview window the controls become distorted in size and location. Has anyone ever encountered anything like this? Thanks, Bill ...

Printing problem in booklet format
When I try to print my booklet document, on the screen it looks perfect, but when i go into print preview it only has half of each page on the paper. When i print, it comes out exactly like that. I have Publisher 2003 and run it on XP home. My printer is an Epson stylus Photo RX650. I contacted Epson and they say its a Publisher problem. Any suggestions. Driver? http://tech.epson.com.au/downloads/product.asp?sCategory=Multi_Functional&id=stylusphotorx650&FileType=1&EmailAdd=&MetricIDReturned=624915&platform=winxp Are you selecting booklet in page setup? Do you ...

Report: Cell #1, Cell #2, Cell #3, Cell #4
I am stuck again and would love som help :( I would like to repeat all words found inside ~25 cells, separated only by ", ", ignoring empty cells. Data: A1: [Apple ] A2: [Orange] A3: [Banana] A4: [Tomato] A5: [Syrup ] A6: [ ] A7: [ ] A8: [ ] The result should be something like: [Apple, Orange, Banana, Tomato, Syrup] -- JemyM ------------------------------------------------------------------------ JemyM's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=26945 View this thread: http://www.excelforum.com/showthread.php?thre...

Departments on Z Report
Hello, I have noticed that as I set up new departments and categories into the database, the new departments are always printed last...or below all of the other departments. Is there a way to change this, and possibly have them organized alphebetically or in an order I would like? Thank You, Vicne Perhaps if you modified the department table usinfg Microsoft Access 2003 .... not that I would advise that :-) Vince... is this you... my buddy? Since you don't use an email address... I'm never sure if it you... and then I worry I'm getting too personal with someone I don'...

Printing a newsletter on 11x17 not in full size
I am trying to print my 4 page newlsetter that is 8.5x11 on 11x17 so that it is a folded newsletter. It prints on the 11x17 but it keeps printing small with crop lines. It is in the right order but not full size. PLEASE HELP What version Publisher? Are you using Publisher 2007? Are you setting up your printer first for 11 x 17? File, page setup, booklet, select custom size 8.5 x 11, click advanced on the right, select booklet in the pull down type 8.5 width 11 height -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Tam Nee...

How do I assign a name to a PDF report via VBA
Thanks to the internet site: http://msdn.microsoft.com/en-us/library/ee336132.aspx I have the following subprocedure: Private Sub Print_to_PDF_Click() On Error Resume Next Dim reportName As String reportName = "HCBS CMgr Smmry Report" DoCmd.OpenReport reportName, _ View:=acPreview, WindowMode:=acHidden Set Reports(reportName).Printer = _ Application.Printers("CutePDF Printer") DoCmd.OpenReport reportName, _ View:=acViewNormal End Sub This appears to be a good start; however, it stops and waits for me to enter the n...