conditional text box

M

mikebo

Can I have a textbox and the data in a report show up contingent upon another
field? For example:

I have several groups of items and I sum over each group. I only want the
sum to show up for certain groups, but not for others. Can I make a textbox
disappear somehow with an IIF() statement or similar? The properties only
allow yes and no for "visible",or can I enter other statements there?
 
D

Duane Hookom

You can enter any expression that evaluates to true or false. An IIf()
expression should also work.
 
M

mikebo

If I put in anything else but yes or no, I get an error message that tells me
I have to select either yes or no, so I guess an IIF() expression does not
work.
 
L

Larry Linson

If I put in anything else but yes or no,
I get an error message that tells me
I have to select either yes or no, so I
guess an IIF() expression does not
work.

Put VBA code in the Print event to evaluate the condition and set the
Visible property of the Control... something like

If <whateveryourcondition> Then
Me!txtYourBox.Visible = True
Else
Me!txtYourBox.Visible = False
End If

Larry Linson
Microsoft Access MVP
 
M

mikebo

Found it! But conditional formatting only seems to apply for the text box
itself, not for the label. It's disabled for the label. Is that correct?
 
Top