Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / April 2005

Tip: Looking for answers? Try searching our database.

Setting the Use Specific Printer

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
James - 26 Feb 2005 23:32 GMT
I need the user to be able to select the printer for 2 different reports.  I
have seen the printer programs that others have made, but I can't change
system information because of another program that uses the default printer.

Option A: I would like to have a form that shows only the 2 reports and then
lets the user change the "Use Specific Printer" paremeter.  The user cannot
open the report to preview.  They can only print it.  Is this possible.

Option B: I would let the user open the reports in preview, from the
switchboard, and let them change the specific printer.  However, this method
shows a dialog box for the filtered record number and the report shows errors
on it.  I don't think that looks professional.

What should I do?
Ken Snell [MVP] - 27 Feb 2005 00:23 GMT
Are you using ACCESS 2002 or 2003? If yes, check out the Application.Printer
object in Help. It will let you change the printer for a specific report
just before you print it, and then you can "unset" that selection by setting
the object to Nothing afterwards. You also can use the Printers collection
to get the choice of printers for display in the form.

Signature

       Ken Snell
<MS ACCESS MVP>

>I need the user to be able to select the printer for 2 different reports.
>I
[quoted text clipped - 16 lines]
>
> What should I do?
James - 27 Feb 2005 20:43 GMT
Thank you for your help Ken.  So I can make a form that has all of the
printers in a drop-down box.  Then I store that in a global string variable
(called SlipPrinter).  Then on the form that prints the slip I would type:

Application.Printers (SlipPrinter)
DoCmd.OpenReport "Report Name", acViewNormal
Application.Printers = nothing

Is that correct?  I think I am missing something!

> Are you using ACCESS 2002 or 2003? If yes, check out the Application.Printer
> object in Help. It will let you change the printer for a specific report
[quoted text clipped - 22 lines]
> >
> > What should I do?
Ken Snell [MVP] - 28 Feb 2005 15:40 GMT
Close.

Set Application.Printer = Application.Printers (SlipPrinter)
DoCmd.OpenReport "Report Name", acViewNormal
Set Application.Printer = Nothing

Also, be sure that SlipPrinter contains the DeviceName string from the
desired printer.
Signature


       Ken Snell
<MS ACCESS MVP>

> Thank you for your help Ken.  So I can make a form that has all of the
> printers in a drop-down box.  Then I store that in a global string
[quoted text clipped - 38 lines]
>> >
>> > What should I do?
James - 28 Feb 2005 23:13 GMT
Ken, thank you for your help again!  This is what I have but in the immidiate
window I type debug.print SlipPrinter it gives me a blank line.  If I replace
it with DLookup... it shows the correct printer.  Also when I run the code I
get this error:

Runtime error 438 Object doesn't support this property or method.

And ideas?

-----------Start of code-------------
Private Sub Preview_Click()
   Dim SlipPrinter As String
   
   SlipPrinter = DLookup("[Printer]", "DefaultLabelPrinter", "[ID] = 1")
   
   
   Set Application.Printer = Application.Printer(SlipPrinter)
   If Me.blnMailbox = True Then
       DoCmd.OpenReport "MailboxSlip", acViewNormal
   End If
   If Me.blnPackage = True Then
       DoCmd.OpenReport "PackageSlip", acViewNormal
   End If
   DoCmd.Close acForm, "Reprint Slip Options"
   Application.Printer = Nothing

End Sub
-------------end of code-----------------------

> Close.
>
[quoted text clipped - 46 lines]
> >> >
> >> > What should I do?
Ken Snell [MVP] - 28 Feb 2005 23:40 GMT
In my original reply, I noted that you must be using ACCESS 2002 or 2003 for
this approach to work. Are you using an earlier version of ACCESS?

Signature

       Ken Snell
<MS ACCESS MVP>

> Ken, thank you for your help again!  This is what I have but in the
> immidiate
[quoted text clipped - 83 lines]
>> >> >
>> >> > What should I do?
James - 01 Mar 2005 02:29 GMT
I am using 2003.  I did have the mdb file saved as 2000 format, but converted
it to 2002-2003 format but still same error.

> In my original reply, I noted that you must be using ACCESS 2002 or 2003 for
> this approach to work. Are you using an earlier version of ACCESS?
[quoted text clipped - 86 lines]
> >> >> >
> >> >> > What should I do?
Ken Snell [MVP] - 01 Mar 2005 02:36 GMT
I see a typo:

Change this line:
   Set Application.Printer = Application.Printer(SlipPrinter)

to this:
   Set Application.Printer = Application.Printers(SlipPrinter)

Not sure why SlipPrinter is showing as a blank value, when the DLookup value
is working. What value do you get from the DLookup call?

Signature

       Ken Snell
<MS ACCESS MVP>

>I am using 2003.  I did have the mdb file saved as 2000 format, but
>converted
[quoted text clipped - 99 lines]
>> >> >> >
>> >> >> > What should I do?
James - 01 Mar 2005 02:51 GMT
The DLookup shows the value of the printer that was saved.  I think it works
now, but my file seems to be corrupt, so I will try it again with a backup.

> I see a typo:
>
[quoted text clipped - 110 lines]
> >> >> >> >
> >> >> >> > What should I do?
Sondra - 28 Apr 2005 21:46 GMT
James:

Can you help me with the form you created for the printers?  I would love to
know how you did the whole process of getting the form to actually choose the
correct printer.

> Thank you for your help Ken.  So I can make a form that has all of the
> printers in a drop-down box.  Then I store that in a global string variable
[quoted text clipped - 32 lines]
> > >
> > > What should I do?
James - 30 Apr 2005 16:34 GMT
Sondra,

The code from the previous post is what I used.  However, on some systems
the computer locks up when it tries to print.  I changed it so that the user
can go into the form and change manually the specific printer.

> James:
>
[quoted text clipped - 38 lines]
> > > >
> > > > What should I do?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.