473,507 Members | 2,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change printer destination

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
5 7093
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
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
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

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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
22255
by: Patrick Herb | last post by:
Hello, I'm trying to print the content of a RichTextBox from my VB 6 app. What I want is that the CommonDialog shows up, the user selects a printer and the content of the RichTextBox prints to...
8
15187
by: kchengso | last post by:
One of my printers in my printer.devicename call returns in lower case. Is it possible for me to change it to upper case? I am also wondering how, in the first place, this particular printer...
1
6327
by: Patriicia | last post by:
A legacy application (I don't have the source code for the application) transmits reports to a printer. One of the reports that are sent to the printer needs to be inserted into a database. With...
1
1464
by: Tommy Martin | last post by:
I would like to bring up the printer dialog before my report is sent to the printer to allow the user to select another destination and possibly the number of copies. Can anyone steer me in the...
1
1641
by: tzinno | last post by:
I'm running an Access 2000 application on users' desktops as a runtime; the back-end is on a server. When the user prints an item (a Packing List), I have it coded to print 1 copy of a report to...
0
1252
by: Jurgen Oerlemans | last post by:
Hello, Being new to vb dotnet I have the following problem: I want to manage printjobs by an dotnet application. For this I use the ActiveDS reference. Using this reference, how can I: * find...
0
457
by: BerkshireGuy | last post by:
This code, opens a mail merge and prints to my default printer. How can I modify this code to print to a specific printer on the network and a particular printer tray? Dim WordObj As...
3
2054
by: Bob | last post by:
I need to create a program that is essentially a special fax sender using multi line Dialogic cards. I figure that the best way to do this so that it can be used from any app is to create someting...
0
1383
by: Pivalig | last post by:
Hello, i try to copy file from Pocket PC to network printer using this code : destination = "\\\\pc1\\ep1000\\Bill.txt"; File.Copy("\\Program Files\\MobileKhelner\\Bill.txt", destination); ...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7031
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7485
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5042
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.