473,728 Members | 2,044 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Text visible or not visible.

Can someone help me with some code to make a text box and lable visible
only if the field in the table has something in it?

Thanks

Nov 13 '05 #1
6 19248
In the OnLoad Event of the form, put the code:

If isnull(me.textb oxname) then
me.textboxname. visible = false
else
me.textboxname. visible = true
end if

<ki*********@ya hoo.com> wrote in message
news:11******** **************@ c13g2000cwb.goo glegroups.com.. .
Can someone help me with some code to make a text box and lable visible
only if the field in the table has something in it?

Thanks

Nov 13 '05 #2
Insert this code in the form's (or report's) code module:
(Assuming that the form is bound to a table or query and assuming that
the field myfieldname is bound to a field in the table by the same
name:
example - you have a table named Contacts and in that table you have a
field named LastName. The form is bound to the table Contacts and the
field ypu want to hide or show is named LastName and is bound to the
field LastName in the Contacts table.)

Private Sub Form_Load()
If len(me!myfieldn ame) > 0 then
me.myfieldname. visible = true
me.mylabelname. visible = true
Else
me.myfieldname. visible = false
me.mylabelname. visible = false
End If
End Sub

Also to avoid having the field flicker when the form loads, set the
visible property of the field and the label to false so that it loads
hidden but then is made visible only if it is full.

kingphil...@yah oo.com wrote:
Can someone help me with some code to make a text box and lable visible only if the field in the table has something in it?

Thanks


Nov 13 '05 #3
Put the following code in the form's OnCurrent event:
Me!NameOfTextbo x.Visible = Not IsNull(Me!NameO fTextbox)

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com


<ki*********@ya hoo.com> wrote in message
news:11******** **************@ c13g2000cwb.goo glegroups.com.. .
Can someone help me with some code to make a text box and lable visible
only if the field in the table has something in it?

Thanks

Nov 13 '05 #4
It's best to avoid the user of If IsNull(me.textb oxname) Then since it
does not handle blank rather than null strings...

Nov 13 '05 #5
Just to note putting code in the Load event will only give you what you want
when the form opens. When you navigate from record to record, you will not
get what you want. Coding the form's Current event will give you what yoy
want when the form opens as well as when you navigate from record to record.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com
<ki*********@ya hoo.com> wrote in message
news:11******** **************@ c13g2000cwb.goo glegroups.com.. .
Can someone help me with some code to make a text box and lable visible
only if the field in the table has something in it?

Thanks

Nov 13 '05 #6
True, but the person asked "only if the field has something in it"
If it has a space in it, it contains something.
If not, If isnull will perform the function....
Not to quibble with you, it was just a quick answer.
I could write the other method as well, just longer.
"laurenq uantrell" <la************ *@hotmail.com> wrote in message
news:11******** *************@c 13g2000cwb.goog legroups.com...
It's best to avoid the user of If IsNull(me.textb oxname) Then since it
does not handle blank rather than null strings...

Nov 13 '05 #7

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

Similar topics

28
2599
by: Randy Starkey | last post by:
Hi, Does anyone know where I can get a script that show a little plus sign after a line of text, that when you click the plus sign, more text is revealed on that same page, like a continuing paragraph. This will be on a web page. Thanks! --Randy Starkey
4
2627
by: Arif Çimen | last post by:
Hi to everybody, I have chnged a button text in design mode. But After compiling and executing the program the text of the button do not change to new value. Any Ideas? Thaks for helps.
6
1987
by: Johnny Holland | last post by:
Hi, I am working on a presentation tool (Powerpoint like) that allows the user to display text over a picture background. One of the best ways to make the text stand out would be to put a black outline around the text if it is white (or white outline if black). I have been looking at the DrawString method but it seems to just allow me to put some text behind other text creating a shadow effect which is not what I want. Anyone got any...
2
2104
by: george.leithead | last post by:
Hi all, I have a very strange problem! In following Web page (which is generated from a CMS System), the navigation to the left 'dissapears' when you roll the mouse over the links? It does not do this in all browsers either. I have found it to happen in IE 7 and the latest patched IE 6. I have tried to find out the reason, but keep finding strange behaviour! You will see at the bottom of the HTML, I have a comment. If you follow...
0
2411
by: grgimpy | last post by:
My form has two main text boxes that are not working correctly with the code I wrote. Upon opening the form, the operator must select a "Part Number" from a list box. Once a "Part Number" is selected, some code fills in some parameters in other text boxes and brings up a subform based on a query. This all works fine. The operator must then enter in eight "Thickness" values. Once the last value is entered, three text boxes should calculate...
3
4649
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.
0
2434
by: landesjoe | last post by:
Hi, here's my problem in short: Text boxes in gridview don't seem to hold their value if the column's .Visible property is changed back and forth. I've got a form with a gridview populated from a data view (which in turn is loaded from a manually setup DataTable for testing purposes). One of the columns in the grid is a checkbox that's tied to an event handler that'll change the .Visible property of a column with a text box. That text...
3
1885
by: msg2ajay | last post by:
hi, I am not able to align the textfield to the top of the frame one bye one. The problem is it is showing where it is hiding..... so is it possible to allign the text field to the top of the form one by one. I am sending the sample code. <html> <head> <script type="text/javascript"> function changeme(field){ var val= field.value;
1
3120
by: Joshua | last post by:
I'm creating a web control that has an image and a text box. I would like to then override the Visible and Text property of the usercontrol, so when you reference the visible property of the user control it only set the visible property of the textbox. When i call these newly created property I get the following error: Object reference not set to an instance of an object. Does anybody have any idea? Thank you.
4
6048
by: pablorp80 | last post by:
Hello, Here is what I need: I need the focus and the cursor set to a textbox named txtGT, every time no matter if it is the first page load or whether it is a postback. Here is the problem: I am using AJAX and MasterPages as well as an update panel, the textbox is in a panel. I have tried to do it using different java scripts but I can't get it to work because I am not using asp forms, instead I am using Containers. Here is my code:...
0
8904
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
9424
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
9277
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...
0
8133
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
6013
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4793
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3236
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
2
2668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2161
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.