472,956 Members | 2,247 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Can I read the value of a textbox control on a report?

MLH
I use A97. I've gotten used to reading values from textbox controls
on forms, I've come to rely on it pretty heavily. My habit spills over
into reports. I'm uncertain whether I can reliably read the values
in textbox controls on reports during the OnFormat event code
the same way I've been doing so in forms.

I have a report I call the 402 report and on it is a LaborCost
textbox. I use a line of code something like this

If txtLaborCost > 0 Then Me!txtLaborCost.Visible = True

in an attempt to read the control's value. I'm not sure I'm getting
what I expect. Who knows about this and feels comfortable
commenting about the topic: Thx.
Jan 4 '06 #1
14 2842
Because a report is "built" sequentially, it all depends upon where the
textbox is located and what its control source is -- assuming that we're
talking about code within the report. So, it can be unreliable depending
upon when and where you're trying to read it.

You'll likely have better results if you read the value of the field to
which the textbox is bound.
--

Ken Snell
<MS ACCESS MVP>

"MLH" <CR**@NorthState.net> wrote in message
news:gn********************************@4ax.com...
I use A97. I've gotten used to reading values from textbox controls
on forms, I've come to rely on it pretty heavily. My habit spills over
into reports. I'm uncertain whether I can reliably read the values
in textbox controls on reports during the OnFormat event code
the same way I've been doing so in forms.

I have a report I call the 402 report and on it is a LaborCost
textbox. I use a line of code something like this

If txtLaborCost > 0 Then Me!txtLaborCost.Visible = True

in an attempt to read the control's value. I'm not sure I'm getting
what I expect. Who knows about this and feels comfortable
commenting about the topic: Thx.

Jan 5 '06 #2
MLH
On Wed, 4 Jan 2006 18:55:16 -0500, "Ken Snell"
<kt***********@ncoomcastt.renaetl> wrote:
Because a report is "built" sequentially, it all depends upon where the
textbox is located and what its control source is -- assuming that we're
talking about code within the report. So, it can be unreliable depending
upon when and where you're trying to read it.

You'll likely have better results if you read the value of the field to
which the textbox is bound.

Sounds like a plan to me. What syntax do I use to do exactly that?
Obviously, not Me!BlahBlahBlah.
Jan 5 '06 #3
MLH
BTW, my apologies for my system date setting of 1/17/06. Have
corrected now that I've noticed it.
Jan 5 '06 #4
Me.FieldName

--

Ken Snell
<MS ACCESS MVP>

"MLH" <CR**@NorthState.net> wrote in message
news:t9********************************@4ax.com...
On Wed, 4 Jan 2006 18:55:16 -0500, "Ken Snell"
<kt***********@ncoomcastt.renaetl> wrote:
Because a report is "built" sequentially, it all depends upon where the
textbox is located and what its control source is -- assuming that we're
talking about code within the report. So, it can be unreliable depending
upon when and where you're trying to read it.

You'll likely have better results if you read the value of the field to
which the textbox is bound.

Sounds like a plan to me. What syntax do I use to do exactly that?
Obviously, not Me!BlahBlahBlah.

Jan 5 '06 #5
MLH <CR**@NorthState.net> wrote in
news:gn********************************@4ax.com:
I use A97. I've gotten used to reading values from textbox controls
on forms, I've come to rely on it pretty heavily. My habit spills over
into reports. I'm uncertain whether I can reliably read the values
in textbox controls on reports during the OnFormat event code
the same way I've been doing so in forms.

I have a report I call the 402 report and on it is a LaborCost
textbox. I use a line of code something like this

If txtLaborCost > 0 Then Me!txtLaborCost.Visible = True

in an attempt to read the control's value. I'm not sure I'm getting
what I expect. Who knows about this and feels comfortable
commenting about the topic: Thx.


A common way of hiding zero entries is described in help files:

***
Custom Formats
Custom number formats can have one to four sections with semicolons (;)
as the list separator. Each section contains the format specification for
a different type of number.

Section Description
First The format for positive numbers.
Second The format for negative numbers.
Third The format for zero values.
Fourth The format for Null values.
For example, you could use the following custom Currency format:

$#,##0.00[Green];($#,##0.00)[Red];"Zero";"Null"
***

To hide zero we might specifiy

$#,##0.00[Green];($#,##0.00)[Red];"";""

This might be simpler, perhaps even safer then setting the visiblity of
the textbox in code.
--
Lyle Fairfield
Jan 5 '06 #6
In Google my response seems to be a response to Ken Snell's second
contribution to this thread. Actually it's a direct reponse to MLH's
original post, which doesn't show in Google.

Jan 5 '06 #7
MLH wrote:
I use A97. I've gotten used to reading values from textbox controls
on forms, I've come to rely on it pretty heavily. My habit spills over
into reports. I'm uncertain whether I can reliably read the values
in textbox controls on reports during the OnFormat event code
the same way I've been doing so in forms.

I have a report I call the 402 report and on it is a LaborCost
textbox. I use a line of code something like this

If txtLaborCost > 0 Then Me!txtLaborCost.Visible = True

in an attempt to read the control's value. I'm not sure I'm getting
what I expect. Who knows about this and feels comfortable
commenting about the topic: Thx.


From experience, I can tell you that it is common and reliable to read
text box values in Format events on reports. You can safely access the
value of any control in the section/instance being formatted, or in the
header or footer of any section it is contained within. You can read
footer control values even though the footer will be printed after the
section/instance being formatted because the control's value has already
been determined, even though the formatting to display it might not be.
Jan 5 '06 #8
MLH
On Wed, 4 Jan 2006 20:28:51 -0500, "Ken Snell"
<kt***********@ncoomcastt.renaetl> wrote:
Me.FieldName

Thx much, Ken.
Jan 5 '06 #9
MLH
From experience, I can tell you that it is common and reliable to read
text box values in Format events on reports. You can safely access the
value of any control in the section/instance being formatted, or in the
header or footer of any section it is contained within. You can read
footer control values even though the footer will be printed after the
section/instance being formatted because the control's value has already
been determined, even though the formatting to display it might not be.

Thx Steve. I'm glad to hear someone confirm this. I make assumptions
that are wrong all the time. I'd done a fair amount of testing on this
topic, but I hadn't convinced myself that was entirely reliable. Thx
for helping out.
Jan 5 '06 #10

"Steve Jorgensen" <no****@nospam.nospam> wrote in message
news:Np******************************@comcast.com. ..
MLH wrote:
I use A97. I've gotten used to reading values from textbox controls
on forms, I've come to rely on it pretty heavily. My habit spills over
into reports. I'm uncertain whether I can reliably read the values
in textbox controls on reports during the OnFormat event code
the same way I've been doing so in forms.

I have a report I call the 402 report and on it is a LaborCost
textbox. I use a line of code something like this

If txtLaborCost > 0 Then Me!txtLaborCost.Visible = True

in an attempt to read the control's value. I'm not sure I'm getting
what I expect. Who knows about this and feels comfortable
commenting about the topic: Thx.


From experience, I can tell you that it is common and reliable to read
text box values in Format events on reports. You can safely access the
value of any control in the section/instance being formatted, or in the
header or footer of any section it is contained within. You can read
footer control values even though the footer will be printed after the
section/instance being formatted because the control's value has already
been determined, even though the formatting to display it might not be.


Does the "On Format" event fire each time the page is viewed? I would think
you could have a problem if the user paged up and down causing repeated
updates from the control.
Jan 5 '06 #11
paii, Ron wrote:
"Steve Jorgensen" <no****@nospam.nospam> wrote in message
news:Np******************************@comcast.com. ..
MLH wrote:
I use A97. I've gotten used to reading values from textbox controls
on forms, I've come to rely on it pretty heavily. My habit spills over
into reports. I'm uncertain whether I can reliably read the values
in textbox controls on reports during the OnFormat event code
the same way I've been doing so in forms.

I have a report I call the 402 report and on it is a LaborCost
textbox. I use a line of code something like this

If txtLaborCost > 0 Then Me!txtLaborCost.Visible = True

in an attempt to read the control's value. I'm not sure I'm getting
what I expect. Who knows about this and feels comfortable
commenting about the topic: Thx.


From experience, I can tell you that it is common and reliable to read
text box values in Format events on reports. You can safely access the
value of any control in the section/instance being formatted, or in the
header or footer of any section it is contained within. You can read
footer control values even though the footer will be printed after the
section/instance being formatted because the control's value has already
been determined, even though the formatting to display it might not be.

Does the "On Format" event fire each time the page is viewed? I would think
you could have a problem if the user paged up and down causing repeated
updates from the control.


It is not predictable when Format will fire, how many times, or in what
order. It's OK though, so long as your code does not do anything that
should care. If you need a counter, for instance, use a running sum
contol with a Control Source of =1 rather than using a counter in code
because accuracy of the the running sum will be maintaned for us by Access.
Jan 5 '06 #12
Steve Jorgensen <no****@nospam.nospam> wrote in
news:ir********************@comcast.com:
paii, Ron wrote:
"Steve Jorgensen" <no****@nospam.nospam> wrote in message
news:Np******************************@comcast.com. ..
MLH wrote:

I use A97. I've gotten used to reading values from textbox
controls on forms, I've come to rely on it pretty heavily.
My habit spills over into reports. I'm uncertain whether I
can reliably read the values in textbox controls on reports
during the OnFormat event code the same way I've been doing
so in forms.

I have a report I call the 402 report and on it is a
LaborCost textbox. I use a line of code something like this

If txtLaborCost > 0 Then Me!txtLaborCost.Visible = True

in an attempt to read the control's value. I'm not sure I'm
getting what I expect. Who knows about this and feels
comfortable commenting about the topic: Thx.

From experience, I can tell you that it is common and
reliable to read
text box values in Format events on reports. You can safely
access the value of any control in the section/instance being
formatted, or in the header or footer of any section it is
contained within. You can read footer control values even
though the footer will be printed after the section/instance
being formatted because the control's value has already been
determined, even though the formatting to display it might
not be.

Does the "On Format" event fire each time the page is viewed?
I would think you could have a problem if the user paged up
and down causing repeated updates from the control.


It is not predictable when Format will fire, how many times,
or in what order. It's OK though, so long as your code does
not do anything that should care. If you need a counter, for
instance, use a running sum contol with a Control Source of =1
rather than using a counter in code because accuracy of the
the running sum will be maintaned for us by Access.

The On Retreat event fires when paging up, and I've used it
successfully to maintain counter accuracy.

--
Bob Quintal

PA is y I've altered my email address.
Jan 5 '06 #13
Bob Quintal wrote:
Steve Jorgensen <no****@nospam.nospam> wrote in
news:ir********************@comcast.com:

paii, Ron wrote:
"Steve Jorgensen" <no****@nospam.nospam> wrote in message
news:Np******************************@comcast.c om...
MLH wrote:
>I use A97. I've gotten used to reading values from textbox
>controls on forms, I've come to rely on it pretty heavily.
>My habit spills over into reports. I'm uncertain whether I
>can reliably read the values in textbox controls on reports
>during the OnFormat event code the same way I've been doing
>so in forms.
>
>I have a report I call the 402 report and on it is a
>LaborCost textbox. I use a line of code something like this
>
>If txtLaborCost > 0 Then Me!txtLaborCost.Visible = True
>
>in an attempt to read the control's value. I'm not sure I'm
>getting what I expect. Who knows about this and feels
>comfortable commenting about the topic: Thx.

From experience, I can tell you that it is common and
reliable to read
text box values in Format events on reports. You can safely
access the value of any control in the section/instance being
formatted, or in the header or footer of any section it is
contained within. You can read footer control values even
though the footer will be printed after the section/instance
being formatted because the control's value has already been
determined, even though the formatting to display it might
not be.
Does the "On Format" event fire each time the page is viewed?
I would think you could have a problem if the user paged up
and down causing repeated updates from the control.


It is not predictable when Format will fire, how many times,
or in what order. It's OK though, so long as your code does
not do anything that should care. If you need a counter, for
instance, use a running sum contol with a Control Source of =1
rather than using a counter in code because accuracy of the
the running sum will be maintaned for us by Access.


The On Retreat event fires when paging up, and I've used it
successfully to maintain counter accuracy.


Sure, but why do that? It's hard to know that you've covered all the
cases correctly, dealt with what happens whenyou print from preview,
etc. It's much easeir to make code that doesn't need to keep track of
the order of events than to track of the order accurately.
Jan 6 '06 #14
MLH
Shouldn't be a prob for me. All I'm doing
is setting visible property on a textbox.
Paging through records - some are shown,
some are not. Just depends on the value
in the control.
Jan 6 '06 #15

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

Similar topics

3
by: jaYPee | last post by:
I have a form (dialog form to display report) that has an unbound textbox. I want to pass the value of this textbox to my report. But how can I pass this value if i'm accessing SQL Server 2000...
13
by: MLH | last post by:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) If LaborCost > 0 Then Me!LaborCost.Visible = True If MatlsCost > 0 Then Me!MatlsCost.Visible = True If OtherCost > 0 Then...
2
by: Joe Au | last post by:
I follow the Walkthrough documented on Visual Studio to create an editable data grid but it does not work on getting the value of the textbox in the data grid. The code is copied here. I mark...
3
by: Jeff | last post by:
Help.. I have been using: string sId = ((System.Web.UI.WebControls.TextBox)e.Item.Cells.Controls).Text; To get the value of a cell in my datagrid. When I set the cell to read only, I get...
4
by: MLH | last post by:
I have a report and on it, a subreport control Main Report Name: rptInvoiceMain Sub Report Name: rptInvoiceSubReport SubReport Control Name: rptInvoiceSubReportCtl The...
7
by: turtle | last post by:
I want to find out the max value of a field on a report if the field is not hidden. I have formatting on the report and if the field doesn't meet a certain criteria then it is hidden. I want to...
1
by: viral123 | last post by:
Hi all I am using Crystal report and I am running my report successfully for my query but I want to make my query for one specific date. I want to get the date value from the textbox value. ...
1
by: danielgoss | last post by:
Hi I have a report that has loads of textboxes that calculate things based on the value on another textbox in the report. I have put a hidden textbox on my report that gets its value from an...
23
by: Dan Tallent | last post by:
A textbox has a attribute for ReadOnly. This seems like such a simple concept. When a textbox is set to read only the user cannot change the contents of the field. I have been trying to find...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.