Hide / Unhide Field

  • Thread starter Thread starter bock
  • Start date Start date
B

bock

I have a subform which contains a single text box. Depending on the record
id, this field does or does not contain data (which is okay).

On the main form, I would like to NOT SHOW the subform's field when the
field's value is null.

I have already set all format propeties (border, navigation buttons, record
selector) = NO, so I won't display anything but the actual text field.
Currently, however, I still show the "white background" when the subform's
textfield is null.

So, here's my question... how do I hide the subform's textbox -- on the MAIN
form -- when the subform's textbox is empty?

Thanks,
Tom
 
Forms!frmMainForm!frmSubForm.Visible = False

will make the entire form invisible. Put the code into one or more of the
events of the main form depending on when you are performing this check.
Good places would be OnLoad and OnCurrent of the main form. Another place
might be the AfterUpdate of the field you are looking at. Remember to turn
the visible property back to True when you need it, most like using IF
statements.

Kelvin Lu
 
Kevin:

Thanks for the reply... just one more question though.

If I were to place the code (see below) into the main form, then it can't
find the textfield. Alternatively, if I place the code into the subform,
then it does not find the >>frmMainForm<<.

Any idea how to overcome this problem?

Thanks,
Tom

&&&&&&&&&&&

If Me.OverdueTasks.Value = Null Then
Forms!frmCorrespondence!frmTasksBehindSchedule_Subform.Visible = False

Else
Forms!frmCorrespondence!frmTasksBehindSchedule_Subform.Visible = True
End If
 
You're using

If Me.OverdueTasks.Value = Null Then

Just use

If Me.OverdueTasks = Null Then

When you refer to a text box it refers to the value in the box. You don't
need .Value to find the value.

Kelvin Lu
 
Back
Top