Conditional Formatting

C

Craig

Tried to do conditional formatting on a form that requires 6 requirements.
Doing it manually from the works fine except it only holds 3 different
conditions, 3 short. Using the code does not work; getting a error #7966.
Code below:
With forms("frmTracking").Controls("OrderStatus").FormatConditions(1)
.BackColor=255
.ForeColor=0
End With

TIA
--Craig
 
L

Linq Adams via AccessMonster.com

If you look again at the Example in Access Help for doing this in code (which
I suspect is where you got your code from) you'll see the line that states:

"The following example sets format properties for an existing conditional
format for the control."

The critical word here is "existing conditional format."

In other words, in Design View you have to go to

Format - Conditional Format

and enter a condition. Then and only then can you set the formatting commands,
as you're trying to do. You have no condition set, hence the error. You're
trying to set formatting for a condition that hasn't been set.

Sad to say, the bottom line to all of this, of course, is that you're still
limited to three conditions (actually four if you consider the Default
display setting.)

I'm assuming you're trying to do this for a Continuous or Datasheet View form.
In Single View, you can set as many conditions as you want by doing the
formatting in the Form_Current event.
 

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