By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,719 Members | 1,036 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,719 IT Pros & Developers. It's quick & easy.

Change printer destination

P: n/a
My Access 2000 code has been running for several years in our main
plant. Now we need to install it, as a stand-along application, at
remote sites, some of which are out of state.
My problem is the printer destination for special reports such as
stickers and mailing labels. The Mailing Label report is, of course,
designed here for a specific printer (Mailing Label). At another site,
the name could be completely different. Other than forcing all sites
to use identical printer names, what are my options for changing the
report design to accomidate the local printers?
The remote sites would certainly be receiving periodic updates so
this would be an ongoing problem to solve. Saving the local printer
name in the registry, for instance, would be fine with me but I still
need a way, more or less automatically to change the report design.
I believe, if the report cannot find the specific printer, it
prompts the user to select the Default Printer
Hank Reed

Nov 13 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hank wrote:
My Access 2000 code has been running for several years in our main
plant. Now we need to install it, as a stand-along application, at
remote sites, some of which are out of state.
My problem is the printer destination for special reports such as
stickers and mailing labels. The Mailing Label report is, of course,
designed here for a specific printer (Mailing Label). At another site,
the name could be completely different. Other than forcing all sites
to use identical printer names, what are my options for changing the
report design to accomidate the local printers?
The remote sites would certainly be receiving periodic updates so
this would be an ongoing problem to solve. Saving the local printer
name in the registry, for instance, would be fine with me but I still
need a way, more or less automatically to change the report design.
I believe, if the report cannot find the specific printer, it
prompts the user to select the Default Printer
Hank Reed


See this link for some examples of changing the printer.

http://www.mvps.org/access/reports/rpt0009.htm

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
Nov 13 '05 #2

P: n/a
If the printer is one of the one that is installed on your computer, you can
open the report in design view, choose Page Setup from the File menu, and
choose a specific printer for the report. Save, and it will remember to go
to that printer.

If the printer needs to be chosen at runtime, try this link:
http://www.members.shaw.ca/AlbertKal.../printch2k.zip

Access 2002 and 2003 have another alternative that is not available if you
use 2000. Details:
http://allenbrowne.com/AppPrintMgt.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Hank" <ha********@aol.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
My Access 2000 code has been running for several years in our main
plant. Now we need to install it, as a stand-along application, at
remote sites, some of which are out of state.
My problem is the printer destination for special reports such as
stickers and mailing labels. The Mailing Label report is, of course,
designed here for a specific printer (Mailing Label). At another site,
the name could be completely different. Other than forcing all sites
to use identical printer names, what are my options for changing the
report design to accomidate the local printers?
The remote sites would certainly be receiving periodic updates so
this would be an ongoing problem to solve. Saving the local printer
name in the registry, for instance, would be fine with me but I still
need a way, more or less automatically to change the report design.
I believe, if the report cannot find the specific printer, it
prompts the user to select the Default Printer
Hank Reed

Nov 13 '05 #3

P: n/a
Gentlemen,
Thanks for the input but I need to be able to change a report
design programatically not change the default printer. I do use the
functions you suggested and they work fine.
I have been using the following code to change the number of
copies or change orientation, dynamically. That works fine. Because
strDeviceName is part of the printer structure, I thought I could
control the destination printer also.
My code is included. I can read the current printer (after
conversion), set a different printer, and read it again to see the
change but the change does not actually happen.
Any ideas would be apppreciated.
Hank Reed

'
************************************************** ********************
' Test ways to change printer destination programically 03/02/05
Private Sub PrintTest_Click()

Dim DevString As str_DEVMODE
Dim dm As type_DEVMODE
Dim strDevModeExtra As String
Dim rpt As Report
Dim rptName As String

rptName = "Holidays"

' Open report in Design view.
DoCmd.OpenReport rptName, acDesign
Set rpt = Reports(rptName)
If (Not IsNull(rpt.PrtDevMode)) Then
strDevModeExtra = rpt.PrtDevMode
' Gets current DEVMODE structure.
DevString.RGB = strDevModeExtra
LSet dm = DevString

' These changes have effect
dm.intCopies = 2 ' Set copies requested by user
dm.intOrientation = 2 ' 2 = Landscape

' Show the current printer desination for this report design
MsgBox StrConv(dm.strDeviceName, vbUnicode)
' Change the printer destination
dm.strDeviceName = StrConv("CartonLabel ", vbFromUnicode)
' Show the current printer desination again
MsgBox StrConv(dm.strDeviceName, vbUnicode)
LSet DevString = dm ' Update property.

' Update the report design data that you just changed above
' IS 94 ENOUGH CHARACTERS TO SAVE ??
Mid(strDevModeExtra, 1, 94) = DevString.RGB
rpt.PrtDevMode = strDevModeExtra
End If
' Print the report
DoCmd.OpenReport rptName, acPreview
DoCmd.PrintOut acPrintAll
' Save design change
DoCmd.Close acReport, rptName, acSaveYes

End Sub

Nov 13 '05 #4

P: n/a

You are nearly there. You need another database containing one table
which
holds the name of the printer (or printers). You can keep any
information
about the printer.

In your frontend link to this table as well as to the usual tables in
your
backend on the server.

Each machine will have its own copy of the printer name database. A
simple
interface on this will enable you to enter/edit the printer name.

Once set up, your code will work by looking up the local printer name
from
the local database

You need to call your function just before the relevent Docmd.OpenReport
command.
Ron Devenish

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #5

P: n/a
Devonish wrote:
You are nearly there. You need another database containing one table which holds the name of the printer (or printers). You can keep any
information about the printer.
In your frontend link to this table as well as to the usual tables in
your backend on the server.

Each machine will have its own copy of the printer name database. A
simple interface on this will enable you to enter/edit the printer name. Once set up, your code will work by looking up the local printer name
from the local database

You need to call your function just before the relevent Docmd.OpenReport command.
Ron Devenish

Ron,
Thanks for your ideas. It looks like a good way for everyone to
have there own unique printer list. I'm sure I'll use that if I solve
my original problem of changing printers on the fly.
The code that I included with my last message DOES NOT work for
changing the printer destintation (I can change number of copies and
orientation). That code originally came from Albert Kallal. I went
back to his structure called type_DEVMODE and changed the size of
strDeviceName to be 32 characters and the whole structure from 94 to
110 characters, to accomidate longer printer names. Still, even though
it appears that I change the name is my test function (I can read back
the new name) it does not actually change.
One of Al's suggestions was to save the default printer name,
change the desired destination printer to be default, print the report,
and then reset to the original default printer. But that means I would
have to do my report design, in this case, on a 8 1/2" by 11" outline
when I am actually targetting a 1" X 2" label.
Any thoughts?
Hank Red

Nov 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.