Setting the Use Specific Printer

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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.
 
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!
 
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.
--

Ken Snell
<MS ACCESS MVP>
 
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-----------------------
 
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?


--

Ken Snell
<MS ACCESS MVP>

James said:
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-----------------------

Ken Snell said:
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.
 
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.

Ken Snell said:
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?


--

Ken Snell
<MS ACCESS MVP>

James said:
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-----------------------

Ken Snell said:
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.
--

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
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
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.

--

Ken Snell
<MS ACCESS MVP>

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?
 
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?

--

Ken Snell
<MS ACCESS MVP>

James said:
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.

Ken Snell said:
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?


--

Ken Snell
<MS ACCESS MVP>

James said:
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.

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.
--

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
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
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.

--

Ken Snell
<MS ACCESS MVP>

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?
 
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.

Ken Snell said:
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?

--

Ken Snell
<MS ACCESS MVP>

James said:
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.

Ken Snell said:
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?


--

Ken Snell
<MS ACCESS MVP>

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.

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.
--

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
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
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.

--

Ken Snell
<MS ACCESS MVP>

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?
 
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.
 
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.
 
Back
Top