I have a database that records advertising information for a small publication. The database is accessed by (3) departments: sales, accounting, and production. Currently, information for all of those departments is printed on 1 common report. I would like the ability to separate the information into 3 individuals reports and output those forms to 3 individual networked printers. When the operator presses a command button to save the info, I want corresponding reports to output on a printer in the sales department, accounting department, and production department. I'm stumped on this one, anyone have any ideas?
Working directly with printers has never been a strong point in Access when trying to build applications.
The most straight forward way is to open each report in design view and set the printer setup to "Specific Printer" and select the desired printer. Have 3 separate reports and use the DoCmd.OpenReport with the acNormal flag for each report in code behind the button. This generally works, depending on how the network and the printers are setup.
There are more complicated ways of accomplishing printer control. For a complicated set of controls that allow you full control over the printer functions, try this.
Good luck ... although providing a common control interface for applications to print was one of Bill Gate's original intentions with creating Windows, printer control still leaves a lot to be desired on the developer's side.
I figured I'd have to create individual reports and then tie each one to a specific printer. The question now is, can I tie all three reports to 1 specific command button so that when clicked, the button invokes the printing of all 3 reports?
Ae you familiar with adding code in the modules behind the forms? You mentioned a "Save" button. If your save button goes to a macro, convert the macro to code and then add the following lines to your code:
Dim strSQL As String
strSQL = "[MyField] = '" Me.MyField & "'" ' The Where Clause
DoCmd.OpenReport "ReportName_1", acViewNormal, , strSQL
DoCmd.OpenReport "ReportName_2", acViewNormal, , strSQL
DoCmd.OpenReport "ReportName_3", acViewNormal, , strSQL
The strSQL is only needed if you are applying a filter to the report. If you are not, drop the strSQL and the last two commas.
The acViewNormal flag will print the report - the "Normal" state for a report is to be printed.
Ok, everything worked great with the code, but all 3 of the reports printed from one printer. (Which is set as default on my system) I opened each form individually and changed the "Selected Printer", but when I print the reports, everything reverts back to the defaulted printer. Any ideas?