magmike said:
Neither of those worked. The first, hid the box at all times, and the
other had no effect at all.
I think the Current event would be a better place for the code, assuming you
want the box's visible property to change from record to record depending on
the value in CONTACTFIRSTNAME01. The Load event runs once when the form is
opened. I'm not sure what record it looks at to determine the Visible
property you seek, but in any case the visible property won't change once
it's set unless there is code elsewhere to accomplish that.
Apologies to Ken if I misunderstand the documentation about IIf, but as far
as I know the IIf function needs parentheses:
IIf(Expression, Action if true, Action if false)
You can use If in VBA:
If Len(CONTACTFIRSTNAME01 & "") = 0 Then
Me.Box01.Visible = False
Else
Me.Box01.Visible = True
End If
The second shorter version of the code Ken provided should work (I assume
that by "no effect at all" you mean the box remained visible), but as
mentioned it needs to be in the Current event if the Visible property is to
be adjusted record-to-record. I'm not sure there is any reason to use <>
for Len (> should be enough), since I don't see how the length could ever be
less than zero. This is just an observation. I doubt it will change
anything.