473,395 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Code not completely running

I posted this about an hour ago, but I don't see it. I apologize if it
is doubled.

Hello all,

I have a form in Access XP that returns all printers intalled on the
user's system. They select which printer they want to print to and
click a "Next" button. The button click event runs the code posted at
the bottom of this message to open a number of reports, change the
printer to the one the user specified, save and close, then print the
reports. The code does everything but save the printer, so the report
prints to whatever printer was previously saved in the report.

This code runs fine if run directly within the module, but when it's
fired from a click event in a form it doesn't.

I have repaired and decompiled, any other thoughts? Thanks in advance
for any advice you may have.

code:

Public Sub sChangePrinter(strReport As String, strDeviceName As String,
Optional strOrientation, Optional strPaperSize)

Dim rpt As Report
DoCmd.OpenReport strReport, acViewPreview
Set rpt = Reports(strReport)
rpt.Printer = Application.Printers(strDeviceName)
rpt.Printer.Orientation = strOrientation
rpt.Printer.PaperSize = strPaperSize
DoCmd.Close acReport, strReport, acSaveYes
rpt.Printer = Application.Printers(strDeviceName)
rpt.Printer.Orientation = strOrientation
rpt.Printer.PaperSize = strPaperSize
DoCmd.Close acReport, strReport, acSaveYes
DoCmd.OpenReport strReport, acViewNormal

End Sub

Nov 13 '05 #1
0 1126

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jerry Orr | last post by:
I'm writing a simple JNI C++ function on a z/OS 1.4 system. I am attempting to rename a dataset; however, when I use the rename() function, I get a return code of -1. All of the return codes listed...
20
by: vb | last post by:
hi all, I have to compare an address of structure with an absolute address(this address signifies the start of a memory component). Now my question is the follwong code leagal:- #include...
15
by: Bryan | last post by:
I have a multi-threaded C# console application that uses WMI (System.Management namespace) to make RPC calls to several servers (600+ ) and returns ScheduledJobs. The section of my code that...
5
by: Joe Simmonds | last post by:
Hi All, I have just had a problem with some VB.net, I wonder if anybody can shed a little light and ease my confused brain. The problem is resolved now but I can't work out what happened and,...
5
by: Antoine | last post by:
Hi I have a novice question. I am writing some code, and several routines in ..NET. So far very succesfully using several sample to work from, though am I jumping in by doing this and I really need...
8
by: Doug Bell | last post by:
Hi, I have been debugging a new VB.Net Application and today, I have been getting an error that I have not seen before This error is now appearing on a line with the following code: lnGUID =...
7
by: Andrea | last post by:
Hi there - I'm hoping someone can help me; I've been struggling with this for a few days! :-) I have a webpage that is comprised of many forms containing questions. As the user answers one...
88
by: Peter Olcott | last post by:
Cab you write code directly in the Common Intermediate language? I need to optimize a critical real-time function.
21
by: Jim | last post by:
I am trying to write an HTTP/HTTPS proxy server in VB.Net 2005. But, I don't really even know how the internal workings of a proxy should act. Does anyone have anything on the protocols used in...
2
by: Beejer | last post by:
I have a weird problem that I'm trying to solve but can't seem to find a solution at this time. My Access database closes completely when the "Else" of the VBA code is applicable. I'm running...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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
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...
0
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...
0
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...

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.