473,778 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Fo rmat(Cancel As Integer, FormatCount As
Integer)
If Me.Discount = 0 Then
Discount.Visibl e = False
End If
End Sub

Jan 14 '07 #1
3 4651
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_Fo rmat(Cancel As Integer, FormatCount As
Integer)
If Me.Discount = 0 Then
Discount.Visibl e = 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.Visibl e = False
Else
Discount.Visibl e = True
End If

Or, more concisely:

Discount.Visibl e = (Me.Discount <0)

--
Marsh
Jan 14 '07 #2
On Sun, 14 Jan 2007 16:50:17 -0600, Marshall Barton
<ma*********@wo wway.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_Fo rmat(Cancel As Integer, FormatCount As
Integer)
If Me.Discount = 0 Then
Discount.Visibl e = 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.Visibl e = False
Else
Discount.Visibl e = True
End If

Or, more concisely:

Discount.Visibl e = (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.com wrote
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
6826
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 frmTrialInfo. Each Trial can have three Classes. The third form is frmClassInfo. These forms are used for update and adding new records. The user displays an event for update (frmEventAdd). Then clicks on a button to display the Trials for that event...
5
4319
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 control then is invisible. How do I make the calendar control pop up over other control in a asp.net c# environment? Charles
2
1657
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 style='position: absolute; left=275px; top=73px; width=725px; height=595px;' width='656px' height='475px' classid='clsid:68CE4C35-090C-470B-B956-96B129554E64' standby='Please Wait...' codetype='application/x-oleobject' codebase='com/test.cab'>" &...
6
14700
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 using the Imagebutton.Attributes.Add("onMouseOver","this.src = 'somepicture.jpg') and that works fine. I've tried some java script to change the other control's visible property by changing is className, but that doesn't seem to work
4
2475
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 ItemDataBound event of the datagrid e.g. If e.Item.Cells(8).Text = "2" Then 'Make the textbox defined in my edititemtemplate read only of invisible End If
16
11589
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, image N, the panel N becomes visible and all the other invisible.
6
5935
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 seed, or your constraints, or your triggers, or your table. Talking to developers at other companies who have had the misfortune of using DB2, they are adamant that you cannot use the tools; they are buggy and you just have to resign yourself to...
1
420
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 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.
5
2992
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 hours on this and couldn't find the solutions, thats why I have to come with a hack. I have two forms, I made the first form invisible and let the second form visible.This form is for google custom search engine. I also tried with other test forms, but...
0
9629
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
9470
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
10298
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10127
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
10069
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
9923
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5500
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4033
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
3
2865
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.