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

How to make control invisible when text value is zero?

I have a report with a text box named Discount. If this text box
shows a value of 0, I do not want the text box to be visible.

I have tried the following code, but it disables the control even when
the value is greater than zero. My IF statement seems to always be
true. Also, I can't find a value property for the text box.

I have searched and can't find the answer via Google.

Thanks.

Private Sub GroupFooter3_Format(Cancel As Integer, FormatCount As
Integer)
If Me.Discount = 0 Then
Discount.Visible = False
End If
End Sub

Jan 14 '07 #1
3 4618
Bill wrote:
>I have a report with a text box named Discount. If this text box
shows a value of 0, I do not want the text box to be visible.

I have tried the following code, but it disables the control even when
the value is greater than zero. My IF statement seems to always be
true. Also, I can't find a value property for the text box.

I have searched and can't find the answer via Google.

Thanks.

Private Sub GroupFooter3_Format(Cancel As Integer, FormatCount As
Integer)
If Me.Discount = 0 Then
Discount.Visible = False
End If
End Sub

There is not automatic thingie that sets Visible to True, so
you have to do it yourself:

If Me.Discount = 0 Then
Discount.Visible = False
Else
Discount.Visible = True
End If

Or, more concisely:

Discount.Visible = (Me.Discount <0)

--
Marsh
Jan 14 '07 #2
On Sun, 14 Jan 2007 16:50:17 -0600, Marshall Barton
<ma*********@wowway.comwrote:
>Bill wrote:
>>I have a report with a text box named Discount. If this text box
shows a value of 0, I do not want the text box to be visible.

I have tried the following code, but it disables the control even when
the value is greater than zero. My IF statement seems to always be
true. Also, I can't find a value property for the text box.

I have searched and can't find the answer via Google.

Thanks.

Private Sub GroupFooter3_Format(Cancel As Integer, FormatCount As
Integer)
If Me.Discount = 0 Then
Discount.Visible = False
End If
End Sub


There is not automatic thingie that sets Visible to True, so
you have to do it yourself:

If Me.Discount = 0 Then
Discount.Visible = False
Else
Discount.Visible = True
End If

Or, more concisely:

Discount.Visible = (Me.Discount <0)
I thought it was "automatic" because they are visible by default and
show up if no code is written?

I guess you are saying that when I change it to False, I have to
change it back when I want it to be True?

Thanks.
Jan 15 '07 #3
"Bill" <Bi**@yahoo.comwrote
I thought it was "automatic" because they are
visible by default and show up if no code is written?
That's almost true... the Visible property is set True by default, UNLESS
you change that Property in Design View. Whatever the value set in Design
View, will apply when the Form is first Opened in Form View. Once you change
it from its Design View setting, it will retain the value you set, until you
change that value or Close the Form. To set it _permanently_ to a different
value, you'd have to make the change in Design View.
I guess you are saying that when I change it to False, I have to
change it back when I want it to be True?
Yes, see above.

Larry Linson
Microsoft Access MVP

Jan 15 '07 #4

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

Similar topics

3
by: Susan Bricker | last post by:
Greetings. I have three forms that are open at the same time. They are related and cascading. The first form (frmEventAdd) is the anchor. Each event can have many Trials. The second form is...
5
by: Charles | last post by:
Hello, I would like for my users to have a calendar control only when needed. IE button click for the control to appear and then once the date is selected. Populate a text box and the calendar...
2
by: ACaunter | last post by:
Hi all, I have the following code in the html part of my asp.net page to display an activeX control object which is like a picture viewer: ---------------------------- Response.Write("<object...
6
by: Selden McCabe | last post by:
I have a form with a bunch of image buttons. When the user moves the mouse over a button, I want to do two things: 1. change the Imagebutton's picture, and 2. make another control visible. I'm...
4
by: NH | last post by:
Hi, I just cannot get this to work. I want to make a cell editable in a datagrid only if the value of another cell is something specific. I am able to capture the value of the other cell via the...
16
by: Miguel Dias Moura | last post by:
Hello, i have 5 panels in an ASP.net / VB page. The panel 1 is visible the other 4 are NOT visible. I also have 5 images: image 1, image 2, ..., image5. When i click one of the images,...
6
by: Ian Boyd | last post by:
Every time during development we had to make table changes, we use Control Center. Most of the time, Control Center fails. If you try to "undo all", it doesn't, and you end up losing your identity...
1
by: Bill | last post by:
I have a report with a text box named Discount. If this text box shows a value of 0, I do not want the text box to be visible. I have tried the following code, but it disables the control even...
5
by: programmerboy | last post by:
I never had this kind of issue before and it is completely surprising. I have a usercontrol where I need 2 forms to make 1 form. When I have only 1 form it submits the page to itself. I have spent...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
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...

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.