Visible Property of Controls on Reports

  • Thread starter Thread starter GitarJake
  • Start date Start date
G

GitarJake

Hello All,

I would like to set the visibility of a label or text box on my report based
on the Null or NotNull value of a corresponding field in my table.

Can this be done? I can't seem to set the visible property to True/False
the way I can in a form. Visible is not an option.

I hope my question is understandable. Please ask for more info if needed.

All help greatly appreciated in advance.


Jake
 
GitarJake said:
Hello All,

I would like to set the visibility of a label or text box on my report based
on the Null or NotNull value of a corresponding field in my table.

Can this be done? I can't seem to set the visible property to True/False
the way I can in a form. Visible is not an option.

I hope my question is understandable. Please ask for more info if needed.

All help greatly appreciated in advance.


Jake

Jake, I'm using A2K and setting the .Visible for labels and text boxes in
the section format event for reports. (If they don't have the Finance Role,
they don't see the Revenue column).
 
GitarJake said:
I would like to set the visibility of a label or text box on my report based
on the Null or NotNull value of a corresponding field in my table.

Can this be done? I can't seem to set the visible property to True/False
the way I can in a form.

In A2K and later, you can use Conditional Formatting for
most of this type of thing.

If you can't get that to do what you want, then you can
always do it with VBA code in the control's section Format
event procedure:

Me.controlname.Visible = Not IsNull(Me.txtsomefield)

where txtsomefield is the name of the text box bound to the
field you want to test for Null.
 
In the Format event of whatever section the control is in:

If IsNull([SomeControl]) Then
[SomeLabel].Visible = False
Else
[SomeLabel].Visible = True
End If

Or... you could also write it as:

SomeLabel.Visible = Not IsNull([SomeControl])

If [SomeControl] is NOT null then [SomeLabel] is Visible.
 
Hi Fred,

Thanks to you, Marshall and Randy for responding.

I have been trying to write the same exact if statement that you have below.
Trouble is when I type in [SomeLabel] and then type the period (.) the
Autofill window appears but Visible is not an option.

Have I done went and broke Access?

TIA

Jake

Fredg said:
In the Format event of whatever section the control is in:

If IsNull([SomeControl]) Then
[SomeLabel].Visible = False
Else
[SomeLabel].Visible = True
End If

Or... you could also write it as:

SomeLabel.Visible = Not IsNull([SomeControl])

If [SomeControl] is NOT null then [SomeLabel] is Visible.

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


GitarJake said:
Hello All,

I would like to set the visibility of a label or text box on my report based
on the Null or NotNull value of a corresponding field in my table.

Can this be done? I can't seem to set the visible property to True/False
the way I can in a form. Visible is not an option.

I hope my question is understandable. Please ask for more info if needed.

All help greatly appreciated in advance.


Jake
 
GitarJake said:
Hi Fred,

Thanks to you, Marshall and Randy for responding.

I have been trying to write the same exact if statement that you have below.
Trouble is when I type in [SomeLabel] and then type the period (.) the
Autofill window appears but Visible is not an option.

Have I done went and broke Access?

TIA

Jake

I've seen several places in A2K where valid properties don't show up in the
Autofill window but that doesn't mean that they won't work. A couple that
immediately come to mind are .Backcolor and .Locked and, at least one place,
where .Name doesn't show up in the list.

Regards,
Randy
 
GitarJake said:
Thanks to you, Marshall and Randy for responding.

I have been trying to write the same exact if statement that you have below.
Trouble is when I type in [SomeLabel] and then type the period (.) the
Autofill window appears but Visible is not an option.

Have I done went and broke Access?

Those Intellisense list is not 100% complete. If you'll
look at the control's property sheet, you should see that it
does have the Visible property, just type it in the code
and it should run fine.
 
Back
Top