VBA

P

PeterM

I need to be able to assign conditional formatting using VBA. Doing it in
design mode is simple...here's what I have....

Dim objFrc As FormatCondition
Me!part.FormatConditions.Delete 'remove any existing formats
Set objFrc = Me!part.FormatConditions.Add(???????)

I can't figure out the proper construct for adding a condition that is an
"Experssion is" condition. The condition that I want to use is

category="engagement"

Someone please help! I've been all over the web and poured through all of
the docs I can get my hands on and have not been able to find the assistance
that I need.
 
D

Dirk Goldgar

PeterM said:
I need to be able to assign conditional formatting using VBA. Doing
it in design mode is simple...here's what I have....

Dim objFrc As FormatCondition
Me!part.FormatConditions.Delete 'remove any existing formats
Set objFrc = Me!part.FormatConditions.Add(???????)

I can't figure out the proper construct for adding a condition that
is an "Experssion is" condition. The condition that I want to use is

category="engagement"

Someone please help! I've been all over the web and poured through
all of the docs I can get my hands on and have not been able to find
the assistance that I need.

Have you looked at www.lebans.com ? I don't know anything about this
subject myself, but Stephen Lebans has done a lot with it.
 
P

PeterM

yes I looked there. there are no examples on "expression is" conditional
formatting VBA
 
D

Dirk Goldgar

PeterM said:
yes I looked there. there are no examples on "expression is"
conditional formatting VBA

Sure there are. I just looked at my copy of his
"A2KConditionalFormatting" database, and found this code in
"clsConditionalFormatting":

========================
' Remove any existing format conditions.
mBGcontrol.FormatConditions.Delete

' Create a format object and add it to the FormatConditions collection.
' We have to pass to pass a value to the function otherwise
' Access will only execute the function once.
' See if we are Highlighting the Current Row or Alternate Rows
If mShowHighlightingAlternate = False Then
Set objFrc = mBGcontrol.FormatConditions.Add(acExpression, _
, "fCurrentRow([customerid])")

Else
Set objFrc = mBGcontrol.FormatConditions.Add(acExpression, _
, "fAlternateRow([customerid])")
End If
========================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top