Conditional Formatting

M

Mary Fetsch

In Access 2003, I had this code to apply conditional formatting to a field:

With GrownYrSeason.FormatConditions _
.Add(acExpression, acNotEqual, Nz(GrownYrYear.Value, "") <> "XXX")
.BackColor = RGB(230, 230, 230)
End With

I recently upgraded to Access 2007, and this code seems to work sometimes,
and other times I get this message:

Run-time error '7966':

The format condition number you specified is greater than the number
of format conditions.

I've tried this all different ways with no luck. Any ideas?

Mary Fetsch
 
D

Damon Heron

If you use acExpression, acNotEqual is ignored. Try removing it and see
what happens.

Damon
 
M

Mary Fetsch

Are you sure? I entered

GrownYrSeason.FormatConditions.Delete

above the code I sent you, and now my code is working.

Thanks for your response!
 

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