Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default of a Print Command Button??? 1

Status
Not open for further replies.

BLutgen

Technical User
May 25, 2001
47
US
I have a form with a command button on it. When you click the command button it automatically prints a report that is based off the current information on the form. Where can I go to get this button to print two copies of the report by default? Is it something I do with the command button or do I change something on the report. I tried using a print macro for the report and it didn't work. Thanks a lot for the help.

Brad
 
In the report's On Activate event put

DoCmd.PrintOut acPrintAll, , , , 2

This will print two copies. Change as needed. The PrintOut Action acts simular to the File - Print option from your menu. See your tutorial on specifics of other options.


Good luck

B-) ljprodev@yahoo.com
ProDev
MS Access Applications
 
Hi!

In such cases I use Customized menu bar or/and open report as Preview or use Common Dialog Control[/].

Aivars
 
Lonnie,
Thanks for the help but it doesn't quite work. I had been playing around with the PrintOut function earlier and couldn't get it working, but your help got me closer. Here's what's happening. The code does not work on the Report because the report is never actually activated. It is printed straight from the form through my command button. It works if you open the report manually(obviously), but not through the command button. I tried putting it in with my command button, but then the button prints off the report and then two copies of the actual form itself. Any suggestions as to how to remedy this? Thanks again!

Brad
 
It's probably not the proper way to do it, but open your report acPreview (as though you were going to view it). Then in the reports On Activate event put...

Private Sub Report_Activate()
Me.Visible = False
DoCmd.PrintOut , , , , 2
DoCmd.Close acReport, "ReportName"
End Sub

This opens the form in view mode, but invisible. Once activated it can execute your printout command and then close.

Worked for me

B-) ljprodev@yahoo.com
ProDev
MS Access Applications
 
Lonnie,
Well I got it working. Like you said, it is kind of a round-about way but it works great! I ran into another problem though that I wonder if you could help me with. It is just a simple query question and I can't get it for the life of me. The name of the query that I am working in is "Panel No Code" There are a bunch of fields in the query but the only ones that matter are:
[no code]
[no code2]
[no code3]
[no code4]
[no code5]
[no code6]
[no code7]
All of these fields share the same options. They all have the exact same values possible in a pull down menu from a value list. I am using a form(named: PanelNoCodefrm) with an unbound combo-box(named: no code) to set the search criteria, which has the same value list as the above fields. So back in the query, in the Criteria line for the no code's I have the following:
[Forms]![PanelNoCodefrm]![no code]
I know that this is the correct code to go get the information...I just must not have it in the right spot. I have it in every Criteria box for all seven "no codes" I need the user to be able to put in a code number(ex. 1000), and have the query bring back any code 1000, no matter which "no code" field it is in. How do I set up my criteria to do this? Thanks in advance if you can help.

Brad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top