473,396 Members | 1,599 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,396 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 2863
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...
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: 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
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
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
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,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.