INVISIBLE IF NO DATA

ALAN

Registered User.
Local time
Today, 08:52
Joined
Jul 12, 2000
Messages
23
How to make a field automatically invisible if no data (#Num) for that field.
 
If (IsNull(Me.YourTxtbox)) Then
Me.YourTxtbox.Visible = False
Else
Me.YourTxtbox.Visible = True
End If
HTH
 
Thanks Rich, but where should I put this statement....I've tried it in "On No Data" and "On Error", the field still visible..For your information, actually the field is a result of 0 divided by 0. Hope to hear from you soon......Thanks in advance..
 
The field still visible....actually the format is "percent"....anyway I had cancelled it to try this statement...it did not work...help me some more plz.....
 
What is being displayed?

0, Nothing (null) or an error?

Rich's code should work, but it may need to be modified to accomodate for what is being displayed (above)
 
The display is #Num!....I'm waiting....Thanks in advance...

[This message has been edited by ALAN (edited 05-26-2001).]
 
This article will explain the reason for your error
Article ID: Q112103
 
ALAN and others,
Please don't post the same question in multiple places. You just waste the time of people who are trying to help YOU. There is another thread for this question where it was answered.

To recap, the problem was caused by a divide by 0 exception so you need to prevent the division operation when the divisor is 0 or null.

IIf(Nz(YourField1,0) = 0, 0, YourField2/YourField1)
 
Its really work.....Thanks Rich, Kevin and Pat...I'm sorry if I had caused difficulties ...I'm too eager to solve my problem...I am glad I had solved it ....thanks to all of you...
 
IIf(Nz(YourField1,0) = 0, me.invisible, YourField2/YourField1)
What's wrong with this statement? Help me plz...
 
The IIf() is a function. Functions return values. They do not set properties. Although the IIf() function can be used to make decisions, it is not the same as the If..Then..Else statement.

The way your original post was worded, the IIf() was appropriate since it was to be used as the control source of a text box. Put the following into the Format event of the detail section:

If Nz(YourField1,0) = 0 Then
me.YourField.Visible = False
else
me.YourField.Visible = True
Me.YourField = YourField2/YourField1
End If
 
Thanks Pat...It Works....Thanks again...
 

Users who are viewing this thread

Back
Top Bottom