coloring lines in continuous forms

Zedster

Registered User.
Local time
Today, 19:20
Joined
Jul 2, 2019
Messages
169
I have created a database to record time bookings. A user is able to see a history of their bookings for each week in a continuous form. Most weeks will contain multiple lines:

W26 - Holiday - 8hrs
W26 - Project 1 - 20 hrs
W26 - Project 2 - 12 hrs
W25 - Project 1 - 20 hrs
W25 - Project 3 - 20 hrs
W24 - Absence - 16hrs
W24 - Project 1 - 24hrs

etc. (dashes indicate column separators)

Currently the lines are displayed in alternate shading. But over the course of the year it becomes difficult to discriminate between weeks.

I would like to identify all lines for a given week so they stand out from an adjacent week. So in the example above I would ideally like all lines for W26 one color and all lines for week 25 a different color.

But I am not sure if possible. I would appreciate any advice or alternative ways of achieving the same
 
use FormatCondition on the ribbon.
also there is limit on how many Conditional Format you can use.
 
Last edited:
I think the limit, if you're using Access 2010 or later version, is 50 conditional formats. So, if there are 52 weeks in a year and you want a different color for each week, you may end up a little bit short.
 
use conditional formatting on a disabled/not locked textbox control the size of your detail section (send to back so it does not hide the other controls). set the back colour to one of the colours you want

then for colours alternating week by week use set the conditional formatting along the lines of

Expression is -- [weekno] mod 2=0

seek weekno to the week number - not 'WK21'
 
Thanks for all the replies

use conditional formatting on a disabled/not locked textbox control the size of your detail section (send to back so it does not hide the other controls). set the back colour to one of the colours you want

then for colours alternating week by week use set the conditional formatting along the lines of

Expression is -- [weekno] mod 2=0

seek weekno to the week number - not 'WK21'

Thanks in particular to CJ_London, you have interpreted exactly what I am looking to do. I had realized I couldn't get CF to change the detail section, but never thought of adding a textbox the entire dimensions of the detail section in the background. I will try it out later today.
 
I have successfully implemented CJ_Londons proposal, with some interesting findings. The form I was styling was in fact a view only form all fields on it were locked and disabled. I added an unbound text box (txtBackground), moved it behind all the other controls and then set the conditional formatting as advised. I set the background to transparent for all other fields.

All worked great except the form appeared to add a blank line at the top of all rows. After a bit of experimenting I discovered txtBackground was receiving the focus and being moved to the top covering the data below it. The solution was to add another unbound text box (txtFocus) 0.01cm high and wide position 0cm left 0cm top and use the forms on current event to set the focus to this. Looks great now. Big thanks to CJ_London
 
good for you. but as said by mr.dbguy, you can only have as many as 50 fc. we have 53 weeks in a year.
 
The solution was to add another unbound text box (txtFocus) 0.01cm
you don't need any height or width, txtFocus will still receive focus if height and width are also zero. It just has to be visible and enabled.

You can also put it in the header section and set header - and set those section heights to zero as well (subject to other controls being there of course)

for txtBackground, also look to set the tab stop property to no. If no controls can receive the focus, the form will receive the focus instead
 
@arnel - OP requires

wk1 - white
wk1 - white
wk1 - white
wk2 - grey
wk2 - grey
wk2 - grey
wk2 - grey
wk3 - white
wk3 - white
wk4 - grey
wk4 - grey
wk4 - grey
 
good for you. but as said by mr.dbguy, you can only have as many as 50 fc. we have 53 weeks in a year.

I only need to alternate between weeks to provide what I need so I only used 2 (could have used 1 TBH)
 
for txtBackground, also look to set the tab stop property to no. If no controls can receive the focus, the form will receive the focus instead

Will probably change to that, more elegant, thanks.
 

Users who are viewing this thread

Back
Top Bottom