View Full Version : Text Box invisble if contents is null


alxj
12-03-2000, 02:16 PM
I have the problem of needing to hide a text box if it contains no value but appear if the control source equation creates a value to put in it. How would i go about doing this.

Thanks

Alex

SomeGuy
12-03-2000, 06:08 PM
I would put the following type of code into the Form_Current property:

If IsNull(TextBoxThatReceivesValue) Then
Me!TextBoxThatReceivesValue.Visible = False
End If

Hopefully this will work for you

R. Hicks
12-04-2000, 03:42 PM
SomeGuy has the right idea, but just didn't take it far enough. It should be:

If IsNull(TextBoxThatReceivesValue) Then
Me!TextBoxThatReceivesValue.Visible = False
Else
Me!TextBoxThatReceivesValue.Visible = True
End If

This is needed if you navigate though the records, the txtbox will change in accordance with each record. If you don't include the "Else", the txtbox would become invisible if you incounter a Null, and it would remain that way.

HTH
RDH

manix
04-01-2008, 02:48 AM
I am trying to do a similar thing here but I have text boxes on a report that are populated by the reports query. This code does not seem to work. I have tried it on various event procedures but it does not seem to want to work.

I have 5 text boxes that, if the query does not return any results in, these txt boxes are not visible and instead, a message is displayed along the lines of "No items to report this month".

The txt boxes are contained within the detail section of the report, and this is continuous. At present I just get 5 blank text boxes in one row when the query does not return any data.

Can anyone help?

Thanks

(Sorry just realised this is in the forms forum, but it seemed like the most appropriate thread)