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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Choose Printers without Allowing Page Setup 1

Status
Not open for further replies.

Knicks

Technical User
Apr 1, 2002
383
US
I am trying to create a locked down system where users can access their printer list during a report run but not have access to Page Setup. The other option would be if they did have access to Page Setup that they not be able to save or save as. I have tried using the docmd.close acreport save no option and I get an error, it may be because of the complex nature the report is run.

I have a dialog box popup form and 2 frames they must satisfy and then a command button that looks at the 2 options selected to choose which report to run (certain frame options also make a text box appear for further data input). I also have code in the reports "on open" to hide the popup form and code "on close" to close the popup form. And I have code selected for "on no data" to close the report along with a message box to tell the user there is no data and show the inputted data.

It would be super cool if the Printer Select box appears and the Page Setup was greyed out, but something tells me that area is a "whole" item and very difficult to remove options. Perhaps I am missing something on the no save, from glimpsing other posts it sounds like there are some twists to the close where users can bypass the typical way to close a report.

Any suggestions would be helpful.
 
Why not just bring up the Print Dialogue box?

I put a custom toolbar on every report, so that's what the user sees when they Preview. They can Send, Save, Print or Close. The code for the Print button is
Code:
Function OpenPrintDialogue()
    On Error Resume Next
    DoCmd.DoMenuItem acFormBar, acFile, 6
End Function


Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
I have a custom toolbar, I know how to reference particular macros, but I haven't figured out how to reference a function or module.
 
Reference a macro that calls the function using the RunCode() function in the macro.

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
Hmmm,

That still allows the user to access "page setup" from within the Printer selection.
 
evalesthy

to retrieve a list of all installed output devices...

Add a list box to the form. Set its name to lstPrinters. Then put the follow code on the form's Load event...
Private Sub Form_Load()
Dim prt as Printer
lstPrinters.RowSourceType = "Value List"
For each prt in Application.Printers
listPrinters.AddItem prt.DeviceName & " on " & prt.Port

Now, if there was only a way to work this onto a tool bar for use with reports. This looks pretty straightforward for form usage though.....
 
Thinking out loud here. I guess you could put a custom print icon (or word) on your toolbar that would pop open a form with the listbox on it. But then you have lost the "from page to page" or "number of copies" functionality - unless you recreate it on the popup form. hmmmm..
 
I actually already start the whole report process with a dialog box form - I wouldn't mind having them choose their printer there, but would that hold up on the report too?
 
I tried playing around with that piece of code and unfortunately it is not the complete code as it does not compile, something about a "for" without a "next". I tried placing a Next at the end and new problems occurred..

Apparently, it was takne from the Access Cookbook, a book I will probably be buying soon. I hate how formulaic most Access books are, as if all we ever want to do is create an inventory system..
 
If you post your code and give us some background information maybe one of us can help you out - that is what tek-tips excels at (no pun intended).
 
Knicks, here is the code corrected
Code:
Private Sub cmdLoadPrinters_Click()
    Dim prt As Printer
    lstPrinters.RowSourceType = "Value List"
    For Each prt In Application.Printers
        lstPrinters.AddItem prt.DeviceName & " on " & prt.Port
    Next
End Sub

________________________________________________________
Zameer Abdulla
Help to find Missing people
Seek counsel of him who makes you weep, and not of him who makes you laugh.
 
ZMR - Thanx for sticking with this!!!

My internet has been down for a few days and I haven't been able to check in. I'll give this a whirl and get back to you,

Thanx,
Again
 
ZMR

I have the list "working", well at least I can see all my printers which is way cool and I can simply place this in the initial dialogue box form when they are preparing to run a report, but I haven't figured out a way yet to make my choice of printer "print" or be the chosen printer for output.

Any suggestions?
 
Thanx,

This looks like some really good code.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top