Highlight certain fields on continuous form

rltomalin
rltomalin used Ask the Experts™
on
Good morning experts,

I have a continuous form.  This includes a Yes/No field called "Waived"
I want to include a description on the continuous form, rather than the tick itself.

I have added a text box called WaivedText, containing the text "Waived" and set its Visible property to No.

I then included the following code for the Section OnPaint event:

Private Sub Detail_Paint()
If Me.Waived = True Then
WaivedText.Visible = True
End If
End Sub

But this will not work because I get the error:
"You can't change the value of this property in the OnPaint event."

I couldn't quite figure out where it should be.

Appreciate some help on this.

Regards

Richard
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
mbizupNerd
Most Valuable Expert 2012
Top Expert 2013

Commented:
Use conditional formatting.

Right-click the control in design view and select Conditional Formatting...

Select "Expression Is" from the drop-down list, and place this in the box provided:

[Waived] = True 

Open in new window



Then set your formatting options to disguise the text.  ("Visible" is not an option, so just disguise it with text color, etc)
Nerd
Most Valuable Expert 2012
Top Expert 2013
Commented:
Alternatively, you can simply clear the text from your textbox based on the value of Waived.

Just set the control source of your textbox to (include the = sign):

= IIF(Waived = True, "Waived", "")

Open in new window



That will display Waived when Waived is true, and will be blank when Waived is false.

Author

Commented:
Hi mbizup

That's great, thanks.  I like the second suggestion best, so that's what I will do.  Works fine.

Regards

Richard

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial