Full Version: conditional formatting weekends
UtterAccess Forums > Microsoft® Access > Access Date + Time
glentz1017
I thought this would be simple but nothing goes that easy. I have text boxes that contain the days of the current month in a special calendar that I made for our scheduling. When the date in the textbos is a Saturday or Sunday (weekday 1 or 7) I want to set up conditional formatting to change the backcolor. I can't figure out how to get the conditional formatting to work with the weekday function. I hope there is a very easy way to do this.
Thanks
George
NoahP
Select the "Expression Is" condition, and use:
eekday([YourTextBoxNameContainingTheDateHere]) In(1,7)
HTH
Noah
glentz1017
Thanks.
Is there a way to let the expression just refer to itself rather than typing the textbox name in each one? This would make it easier to make possible changes in the future.

If not, then is there a way to do the formatting through a sub routine that runs everytime the data in the textbox changes. I would only have to monitor one text box because when on increments to a new date, they all do.
Edited by: glentz1017 on Fri Nov 25 6:58:40 EST 2005.
NoahP
If by 'refer to itself' you mean refer to the value in the control, no. You're not really using the value of the control to determine the condition. You're using a value calculated from the value in the control to do so.
You could use the After Update event of the control to check the Weekday and change the ForeColor accordingly. However, you'll also have to check the Weekday in the form's On Current event so the formatting will change as you move from record to record.
HTH
Noah
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.