Conditionally formatting a calculated value

Chalkie42

Registered User.
Local time
Yesterday, 21:55
Joined
Feb 18, 2008
Messages
42
Hi Folks,

I have a series of textboxes on a form that act as labels for other textboxes that display information. The reason I am using textboxes rather than labels is that they are dynamic i.e. the 1st one is Date(), the second is Date()+1 and so on. They are formatted 'dddd' so that they show the day of the week.

I would liketo have Saturday and Sunday appear 'greyed out' but I don't know how to apply the conditional format that would identify the required days.

I know this is not earth shatteringly important but it would be nice to have.

Thanks , Chalkie.
 
You can use the function weekday to identify the day of the week.

It should be pretty easy to apply condtional formating now you know the function :)
 
Thanks Mailman, I forgot to mention that I'm on the learning curve. How would I implement the function? Is it in VBA or in the Conditional Formatting dialogue?

Chox.
 
Yes....not earth shattering but its the little things that make applications unique.

In Design View, select your TextBox. For the sake of this example let's say it is named txtDate.

Open the Conditional Format dialog window (menu items Format | Conditional Formating...)

You only need one Condition for this to work so, select Expression Is within the Condition 1 Box.

Enter the following line into the Expression Box:

((Weekday([txtDate]) Mod 6=1)=True)

Now, Select the Font Color you want to have the Date text change to should the date within the txtDate TextBox happen to fall on either a Saturday or a Sunday.

That's about it.

.
 
In the dialog.... Use the "Expression is" and put in the function Weekday(date,2) in (6,7)

but you can test it in like a query... or something to find out if it is right...

Ah you got it in the meantime :)
 

Users who are viewing this thread

Back
Top Bottom