473,386 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how to stop form from printing when printing a report from form

I have been trying to use a command button in Access to print a report to the default printer without showing the printer selection screen first. I finally got it to do that using the following code that I found from someone else on your site...

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command29_Click()
  2. 2.     DoCmd.OpenReport "rpt_stamp_label", acViewNormal, , , acHidden
  3. 3.     DoCmd.PrintOut acPrintAll
  4. 4.     DoCmd.Close acReport, "rpt_stamp_label"
  5. 5. 
  6. 6. End Sub
  7.  
The problem I am having is that each time it prints the report, it also prints out a screen shot of the form that the button is activated from. Can anyone help me so that only the report prints?
Oct 12 '15 #1
2 1407
Found the answer on another forum site. The secret was to remove the DoCmd.PrintOut acPrintAll line altogether. It still prints without the printer selection pop-up window showing up and does not print the form where the print function button was clicked. Success!!
Oct 12 '15 #2
zmbd
5,501 Expert Mod 4TB
The problem was that you opened your report in the "hidden" and "Normal"
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "rpt_stamp_label", _
  2.    acViewNormal, _
  3.     , _
  4.     , acHidden
This sent your report directly to the printer and closed the report.
Once closed the focus returned to your form. With the acPrintAll option in the print command it cause the controls as well as any records to print.

Simply, lines 3 and 4 are not needed.
Oct 12 '15 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Randell D. | last post by:
Folks I have the following code for my submit button <input type="submit" name="action" value="Save Article" onClick="this.value='Saving...'; performPrePostChecks();"> I have tested...
2
by: Xiphias | last post by:
Hi, Im trying to change the color of a text box on a report that im printing from a form. On the form I got a check box that has to tricker the color of that textbox on the printed report....
5
by: Wayne Aprato | last post by:
This is probably very simple but: How do I print an open form to the default printer. I want the user to click a button on the form and have it print without them having to bother with the print...
1
by: Kevin Myers | last post by:
Hello folks, I am an experienced developer with other languages and applications, but a neophyte when it comes to MS Access forms. Can someone please help get me with a solution for the...
4
by: bshort1023 | last post by:
Hello, If my report is only 1 page I would like the page footer to print and not the report footer. If the report is more than 1 page I would like the report footer to print and I don't want...
0
by: Tat | last post by:
Hi, I am printing the form. The code is 100% accurate. It is the same as in MSDN, but in C#. ...
6
by: Gary Miller | last post by:
Does anyone know how to detect a modeless form on closing by the form that invoked the modeless form? form.Show();
2
by: polocar | last post by:
Hi, suppose that you have a C# form with two buttons, that are the classical "btnOk" and "btnCancel" (besides them, of course in the form there can be many other controls). When the user clicks...
7
xNephilimx
by: xNephilimx | last post by:
lHi guys! I'm having a little problem that's getting on my nerves, I couldn't find a solution, I also tryed googling it and I found nothing... (my field of expertise is in AS 2 and 3, but I still...
8
by: Mmmel | last post by:
Hi again! Didn't think I'd be back so soon, did ya? :) New (but related) problem...I have the report all done, it's beautiful, displays all the right numbers in all the right places when viewed...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.