473,626 Members | 3,265 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2886
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**@NorthStat e.net> wrote in message
news:gn******** *************** *********@4ax.c om...
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.rena etl> 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**@NorthStat e.net> wrote in message
news:t9******** *************** *********@4ax.c om...
On Wed, 4 Jan 2006 18:55:16 -0500, "Ken Snell"
<kt***********@ ncoomcastt.rena etl> 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**@NorthStat e.net> wrote in
news:gn******** *************** *********@4ax.c om:
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";"Nul l"
***

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.rena etl> 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

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

Similar topics

3
13824
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 using and not the jet engine (mdb)?
13
13170
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 Me!OtherCost.Visible = True End Sub I use procedures similar to the above sub in forms to make controls on the form visible when desired. I'm unable to accomplish this in a report's OnFormat property code. How can I do this on a report?
2
2210
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 "*****" at which the categoryName always get the past value no matter what it has been changed. How do I fix it? Thanks. Joe. Private Sub DataGrid1_UpdateCommand(ByVal source As Object, ByVal e As...
3
2122
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 an error message. I need to retrieve this value so I can use it in my query to update the
4
3271
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 subreport contains 2 fields - a text field where line items sold are listed and a currency field where the price per item is shown. The subreport control displays these two fields when the main report is opened.
7
3234
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 get a max of the field for the ones that are not hidden. is this possible? TIA, KO
1
3450
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. My query small example is as follow: Select name from employee where date_of_birth = '01/01/1984'
1
3848
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 inputbox when the report opens. I then want to use the value inputted in a DSUM calculation on the same form. The hidden textbox is called tbHolddate, its control source is: =InputBox() The textbox that calculates a value using a DSUM control...
23
2204
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 that missing ability for other predefined controls in C#. The radiobutton, checkbox, and combobox controls do not share this ability. I find it difficult to believe that this feature was left out and Microsoft expects everyone to write...
0
8265
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8196
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8637
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...
1
8364
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7193
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...
0
4197
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2625
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
1
1808
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1511
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.