473,770 Members | 2,135 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Assigning different values to a function during the print event in a report instead of its normal output

I noticed I can't push a value into a text box by saying something like,

"txtThisTex tBox = intSomeVariable * 0.5"

because I get an run-time error saying I can't assign a value to this
object.

So instead I made the control source a function to pull the value from the
function. That works. Inside the text box I simply write something like
=SomeFunction() . Beautiful. Works great.

But as I said in another recent post, the data are calulated at format time.
So it recalulates (actually re-formats) again during print, giving double
the expected values. So I need some code to put into the print event to
multiply the value in those text boxes by half (same as dividing by 2 but
avoiding a potential divide-by-zero error). The only problem with that is I
can't specifically push the data into those boxes. Is there a way to query
the program from within the function to see if the current event is Print?
If so I can make the function output half its normal value during the print
event?
Nov 13 '05 #1
1 1846
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You could make the control an Unbound control (the control source is
empty). Then in the section print event procedure (whichever report
section in which the control resides) check the PrintCount variable
before doing the calculation. E.g.:

Private Sub Detail_Print(Ca ncel As Integer, PrintCount As Integer)

If PrintCount = 1 Then
txtThisTextBox = intSomeVariable * 0.5
End IF

End Sub

The calculation expression will only be evaluated one time
(PrintCount=1).

--
MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQXrvX4echKq OuFEgEQIU3ACfe+ A9+xhqZLOyHK1+1 50eCaB8SeUAn2Js
gNC1+8ota4375CW M9+XRWnS+
=Lw2+
-----END PGP SIGNATURE-----
Richard Hollenbeck wrote:
I noticed I can't push a value into a text box by saying something like,

"txtThisTex tBox = intSomeVariable * 0.5"

because I get an run-time error saying I can't assign a value to this
object.

So instead I made the control source a function to pull the value from the
function. That works. Inside the text box I simply write something like
=SomeFunction() . Beautiful. Works great.

But as I said in another recent post, the data are calulated at format time.
So it recalulates (actually re-formats) again during print, giving double
the expected values. So I need some code to put into the print event to
multiply the value in those text boxes by half (same as dividing by 2 but
avoiding a potential divide-by-zero error). The only problem with that is I
can't specifically push the data into those boxes. Is there a way to query
the program from within the function to see if the current event is Print?
If so I can make the function output half its normal value during the print
event?


Nov 13 '05 #2

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

Similar topics

0
1055
by: harold fellermann | last post by:
Hi all, I am trying to write a script that prints out the signatures of each function call that occurs during the execution of a second script which is invoked by my program. i.e. if the inspected program is 'foo.py': def bar(x,y,z=None) : pass bar(1,"a",bar) bar(2,int)
5
5825
by: Tom Louchbaum | last post by:
When I preview my Access 2000 Report it looks fine. When I Email the report using DoCmd.SendObject acSendReport, "Report", acFormatRTF, "To Address", , , "Subject", , False the resulting attachment to the email consistently does not display all of the lines it should in one of the GroupFooters. I am using the Print event in the report to print lines multiple times in a groupfooter depending on an integer set elsewhere in the VBA...
7
2579
by: Dave Hopper | last post by:
Hi I posted a question recently regarding problems I am having getting a value from a list box to use in a query. I got a lot of help, for which I thank you and it's nearly working! But I need a little more help on one more point. This is what i've got. I have code that hunts for updated appointments in a public folder based on the order that happens to be open (code fires on an on open event) This works fine and updates my
2
7827
by: SJM | last post by:
I have a report that displays records of real estate properties. It is possible for each property to appear a number of times for various reasons. Each record however is unique. What I would like to do is display the total of the number of unique properties in the report footer, not just a count of the number of records. I have experimented with grouping on the property field and using running sums but to no avail. I have also tried to...
1
1678
by: Tony Williams | last post by:
I have a 4 Page report , the second page is in two column format. At the moment I have to print page 2 as a separate report and then collate it with the other pages. Is there any way to print a report where the page formats are different. I have tried inserting page 2 as a subreport but that messes up the printing of the other pages. TIA Tony Williams
1
2273
by: ChadDiesel | last post by:
Hello, I have 2 reports that I want to collate (Report 1-Page 1, Report 2-Page 1, Report 1-Page 2, Report 2-Page 2). I used the following code in a module I found in Microsoft support article 231805: Option Compare Database '*********************************** 'Declarations section of the module
7
2556
by: sunfiresg | last post by:
During an interview, I am asked to answer a question: Printf is a major formatted output function provided by the standard C library. Printf accepts a formatting string followed by a various number of arguments to replace formatting specifiers in the formatting string. You should implement the subset of the printf function compliant to the following specification.
5
2508
by: Max ©® | last post by:
Hi all, I'm going crazy... I've report with subreport. I want simply move some objects on report and subreport according to fields value. For example I want hide a label when a field is empty. In *preview* I can hide or move objects on reports's event with VBA. I can correctly know page number, fields value and I can hide or move object. All perfect.
12
3540
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to print the report three times, but do not know how
0
10228
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10057
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9869
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8883
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7415
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5312
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3970
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
2
3575
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.