473,883 Members | 2,864 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Click ok button on print box automatically

54 New Member
I have some code on a button to print a query when clicked. Afterwords the print dialog box comes up. I want it to print without this box coming up or some code to just click ok automatically. All print settings have already been set in my code.
Jul 19 '12 #1
7 24672
zmbd
5,501 Recognized Expert Moderator Expert
Please post your current code using the [code][/code] tags
-z
Jul 19 '12 #2
Becker
54 New Member
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenQuery ("Anodic Unload Sheet Query")
  2. Application.Printer.Orientation = acPRORLandscape
  3. RunCommand acCmdPrint
Jul 19 '12 #3
zmbd
5,501 Recognized Expert Moderator Expert
Expand|Select|Wrap|Line Numbers
  1. DoCmd.SetWarnings false
will suppress messages for action queries... I have not tried it with printouts; however, be careful with this... once set to false all of the warnings are turned off so you can get some very unexpected opppps factor going! When I use this in my code, I always have the argument set back to true in my error traps just incase!

(I have not tested the following);
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenQuery ("Anodic Unload Sheet Query") 
  2. Application.Printer.Orientation = acPRORLandscape 
  3. DoCmd.SetWarnings False
  4. RunCommand acCmdPrint 
  5. DoCmd.SetWarnings true
- please let me know if it works.


-z
Jul 19 '12 #4
Becker
54 New Member
This doesn't work because the print box is not a warning. It is just the standard box for choosing print settings that you would see if you pressed Ctrl+P on a web page. I just don't want users to bother with that box and for it to print automatically after they push to print button on my form.
Jul 19 '12 #5
zmbd
5,501 Recognized Expert Moderator Expert
try the following... it has been proofed.

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenQuery ("Anodic Unload Sheet Query")  
  2. Application.Printer.Orientation = acPRORLandscape  
  3. DoCmd.SetWarnings False 
  4. docmd.printout 
  5. DoCmd.SetWarnings true
I don't usually print directly from a query so I missed this the first time around... my apologies

the
Expand|Select|Wrap|Line Numbers
  1. RunCommand acCmdPrint
is the same as pressing <ctrl+p> or selecting the print icon from the ribbon/toolbar.
-z
Jul 20 '12 #6
Becker
54 New Member
Thanks! That's exactly what I needed. I always thought that "RunCommand " and "DoCmd." were kind of the same thing. I am really new to access. I had never even heard of it or written code before about a month ago. :)
Jul 20 '12 #7
zmbd
5,501 Recognized Expert Moderator Expert
The runcommand is just like if you clicked on the item in menu/ribbon.
The DoCmd is more like you're running one of the macro commands.

More than likely lines 3 and 5 for the warnings aren't needed... forgot to take them out when I tested

Never made sense to me why one has to use macro stuff in a VBA code other than sheer laziness on the part of the developers!

Being new... yep...
I have several of the "Inside/Out..." books dealing with Access and I also went thru http://msdn.microsoft.com/en-us/library/ee861519.aspx although it reads worse than stereo instructions. The rest of the programing comes from being a very old-school programmer... wrote my first programs using a stack of punch cards :) in COBOL... wow... how time flies when you get old, and have kids!

and I still stumble from time to time... that's why boards like this are so valuable - peers helping peers.... wish the world really worked this way as a whole!

-z
Jul 20 '12 #8

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

Similar topics

4
4812
by: yfng | last post by:
In a web form, I want the user clicks on one button and this button will trigger another button/link which will open a new browser window? How to do that? Is there any method like Button.performclick? Thanks
0
1615
by: [Yosi] | last post by:
I search solution for a little bit strange problem , I working on an application which includes a button. Click on this button will create number of threads each one execute deferent executable file, while those threads on going a timer generate . In the timer tick function I kill all the threads an I should run all again by clicking again on the button. means that I should call the click button from the timer function, it's maybe will...
5
6829
by: Steve | last post by:
Hi, Is it possible to make hitting the enter key in an ASP textbox run the code behind an ASP button on a form? I have a search page which users tend to type in the query then just hit enter rather than actually clicking the search button, but this does not run the search code behind the button.
4
2477
by: lasithwaruna | last post by:
hi , im new to php.I want to know how to click a link automatically. i want to go to a url without clicking a link.. plese submit your post thank you....
0
1378
by: radders | last post by:
Hi guys, What I'd like to do is place three edit boxes with three static text labels on a click button. This would let the user input RGB values to the three edit boxes and then click the button to reset the RGB values to 0. Is this possible? I know I could just place a reset button below or to the side, but it doesn't look as good! Cheers, radders
3
1970
by: eddie69 | last post by:
Hi, Newbie question here: I am creating an application in VB Studio 2005 which reads the status of an USB PIR Motion sensor. So far, I have managed to get the application to read the motion sensor's on and/off status by launching the application and applying a Click to a start button. My question is, how can I managed to get the click button to perform automatically without me having to continuosly applying a click? Since the...
12
65317
by: Thammarat charoenchai. | last post by:
Hi, I'm try to learn vb.net. in delphi have .click method for click button by coding. Can I do that with vb.net Thank you very much.
4
11070
by: nittin14 | last post by:
hi guys i m a beginner in Asp.net can u tell me that how to open page in new window after click button as well as i want to pass some data from this page. thanks
5
1956
by: laziers | last post by:
Hi, anyone know how to write a single-cilick button? I use this: <asp:button id="ButtonAdd" runat="server" text="Anuluj" onclick="Click_ButtonAdd" /> if ( !isPostBack){ ButtonAdd.Attributes.Add("onclick",
0
2257
by: abdulazees | last post by:
when click button i want to print autometicaly reportveiwer data, i not need to show reportviewer.
0
9944
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10762
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10863
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10422
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9586
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7136
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5807
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3241
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.