From: davegh7 on
Hi there, I am working in a form where I would like to hide a field if
it is blank/null. I'm using:

If IsNull(Forms![LeasesTable]![Term2]) Then
Forms![LeasesTable]![Term2].Visible = False
Else: Forms![LeasesTable]![Term2].Visible = True

In this case, it would only hide the field if the first record was
blank. I'll have some fields blank and some will not.
From: Allen Browne on
If this is Form View (not Continuous or Datasheet), that should work
provided:
a) you put the code in the forrm's Current event, and
b) you add error handling to cope with the case where Term2 has focus and so
cannot be hidden.

For a Continuous View or Datasheet form, you cannot selectively hide
controls, but it probably doesn't need to.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<davegh7(a)gmail.com> wrote in message
news:b4ffb4e0-2c9c-4c89-a357-7dfbf6047cba(a)x41g2000hsb.googlegroups.com...
> Hi there, I am working in a form where I would like to hide a field if
> it is blank/null. I'm using:
>
> If IsNull(Forms![LeasesTable]![Term2]) Then
> Forms![LeasesTable]![Term2].Visible = False
> Else: Forms![LeasesTable]![Term2].Visible = True
>
> In this case, it would only hide the field if the first record was
> blank. I'll have some fields blank and some will not.