Hide / Unhide Field

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
 
K

Kelvin Lu

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
 
T

Tom

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
 
K

Kelvin Lu

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top