[AccessD] Needing a Fourth Conditional Format

Rocky Smolin rockysmolin at bchacc.com
Sat Oct 13 10:46:22 CDT 2012


Doug:

Not sure this will work for a continuous form where a control (text box)
changes backcolor depending on its value in that record.  

What do you think?

Rocky


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Doug Steele
Sent: Saturday, October 13, 2012 8:38 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Needing a Fourth Conditional Format

Hi Rocky:

You can build format conditions in code; I think there isn't a limit of
three.  Here's a sample I use from a Form_Load event:

  txMargin1.FormatConditions.Delete
  txMargin1.FormatConditions.Add acExpression, , "[txMargin1] <> 0 and
[txMargin1] < " & MarginPct1
  txMargin1.FormatConditions(0).BackColor = 255 'red
  txMargin1.FormatConditions.Add acExpression, , "[txMargin1] <> 0 and
[txMargin1] < " & MarginPct2
  txMargin1.FormatConditions(1).BackColor = 33023 'orange

This article shows an example with 4 conditions:
http://msdn.microsoft.com/en-us/library/office/aa139965(v=office.10).aspx

I used code because I had a ton of fields in a form, all with identical
format conditions, and it is WAY easier to modify code than laboriously work
your way through the wizard for each field.  In the example above, the
client wanted colouring depending on an adjustable profit margin.

Doug


On Sat, Oct 13, 2012 at 8:23 AM, Rocky Smolin <rockysmolin at bchacc.com>wrote:

> Dear List:
>
> I'm making a Gantt chart of scheduled classes for a client - an 
> interactive form where he can scroll forward and backward by a day, a 
> week, a month, or a year.  The course statuses are Scheduled, Complete 
> and Cancelled.  The bars showing the date are color coded red, green 
> and brown. And it's a continuous form.
>
> Working well.  Until...
>
> The user wants to be able to mark a course a Tentatively Scheduled 
> (reserving the space, but not yet booked).  So there's a check box on 
> the Course Schedule form for tentative.
>
> However, he wants the tentatively scheduled class to show on the chart 
> with a different color (I'd go with pink but that's not important, now).
>
> It looks like I need a fourth condition but of course conditional 
> formatting only give you three conditions.
>
> I"m stumped (without redesigning the approach of the whole form - not 
> a pleasant prospect). Any ideas welcome.
>
> MTIA
>
> Rocky Smolin
> Beach Access Software
> 858-259-4334
> www.bchacc.com <http://www.bchacc.com/> www.e-z-mrp.com 
> <http://www.e-z-mrp.com/>
> Skype: rocky.smolin
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list