473,385 Members | 1,824 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,385 software developers and data experts.

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,

"txtThisTextBox = 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 1825
-----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(Cancel 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:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

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

iQA/AwUBQXrvX4echKqOuFEgEQIU3ACfe+A9+xhqZLOyHK1+150eCa B8SeUAn2Js
gNC1+8ota4375CWM9+XRWnS+
=Lw2+
-----END PGP SIGNATURE-----
Richard Hollenbeck wrote:
I noticed I can't push a value into a text box by saying something like,

"txtThisTextBox = 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
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...
5
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...
7
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...
2
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...
1
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...
1
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...
7
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...
5
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. ...
12
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.