Conditional Formatting through Code A2K (1 Viewer)

Treason

#@$%#!
Local time
Today, 14:31
Joined
Mar 12, 2002
Messages
340
I am now using Access 2000+ to create new applications. I find myself limited in what conditional formatting can do. For example, I want to use a conditional format to change the text color to a certain shade of blue (12554099). Conditional formatting only gives me the choices of basic colors.

Can Conditional formatting be set through code?
Does anyone have any code examples?

Thanks
 

DanG

Registered User.
Local time
Today, 11:31
Joined
Nov 4, 2004
Messages
477
Yes it can...

Aircode:

if me.[myfield] = whatever then
me.[myfield].backcolor = RGB(12554099)
Else
me.[myfield].backcolor = vbred
end if

I used backcolor, I think font color is forecolor?
But that's the basic idea.

Hope it helps get you going in the right direction
 

Treason

#@$%#!
Local time
Today, 14:31
Joined
Mar 12, 2002
Messages
340
On which event will this code go?

It changes the color for every record, not for individual rows likes how conditional formatting does..
 

DanG

Registered User.
Local time
Today, 11:31
Joined
Nov 4, 2004
Messages
477
If it is changing all records then you most likely need to look at your if statement again, maybe post your code and we can check it out.
As far as the event goes...it depends...if you are working in a form you can use "on current" or in a report "on open" but it all depends on what you are trying to do but those are two very vesitile events.
 

Treason

#@$%#!
Local time
Today, 14:31
Joined
Mar 12, 2002
Messages
340
DaNG

Thanks for the reply... but I don't think my If statement is the problem...
I have tried it in the on_current event of the form but to no luck...
Once I click an individual record that satisfies the If statement, the code runs on every record, not just the current record.

I am starting to think you cannot conditionally format through code on a continuous form in A2K+...

If you can post a working DB, I would love to be proven wrong.
 

Users who are viewing this thread

Top Bottom