473,548 Members | 2,622 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 7108
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:::mgf0 0 <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.goo glegroups.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.OpenRepor t rptName, acDesign
Set rpt = Reports(rptName )
If (Not IsNull(rpt.PrtD evMode)) 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.intOrientati on = 2 ' 2 = Landscape

' Show the current printer desination for this report design
MsgBox StrConv(dm.strD eviceName, vbUnicode)
' Change the printer destination
dm.strDeviceNam e = StrConv("Carton Label ", vbFromUnicode)
' Show the current printer desination again
MsgBox StrConv(dm.strD eviceName, vbUnicode)
LSet DevString = dm ' Update property.

' Update the report design data that you just changed above
' IS 94 ENOUGH CHARACTERS TO SAVE ??
Mid(strDevModeE xtra, 1, 94) = DevString.RGB
rpt.PrtDevMode = strDevModeExtra
End If
' Print the report
DoCmd.OpenRepor t 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.OpenRepor t
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.OpenRepor t 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
22265
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 the selected printer. I'm not concerned about the text format. What I tried is something like this CommonDialog1.ShowPrinter
8
15190
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 devicename is coded in lower case? Is there a way to change it back using VB6? Thanks
1
6335
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 VB.NET can I intercept items that are sent to the printer? Can I read what is being sent to the buffer with VB.NET and save to a file? Please let me...
1
1468
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 right direction? Thanks in advance. Tommy
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 the default printer, and 1 copy of a different report to a specifically-selected printer. If the specific-destination printer is out of paper, the...
0
1256
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 the printerstatus (not the job status) * Change the destination of the printjobs? So change it from: \\domain\server\printer1 to...
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 Word.Document Set WordObj = GetObject("C:\MyMerge.doc") WordObj.MailMerge.Destination = wdSendToNewDocument
3
2063
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 that can be installed as a printer on the local computer. When sending the print command so that the current document, whatever it is is transmitted...
0
1388
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); It works well, but borrows a lot of time (48 sec) at the first attempt Next attempt after 5 sec working momentaly. I think, that business in...
0
7512
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7438
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7951
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7803
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6036
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5082
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3495
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3475
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1926
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.