Conditional formatting based on other fields in the same record (1 Viewer)

artemis99

New member
Local time
Today, 19:23
Joined
Jul 5, 2020
Messages
6
Hi! I have a continuous form with a list of names, and an active (vs inactive) checkbox. I would like to have conditional formatting based on whether the Active checkbox is ticked or not.
  • I would prefer the formatting to change for the background of the detail itself (continuous form, so highlighting the 'inactive' records), but that seems to be quite difficult and I can't find the right VBA code for it. If you have any suggestions, I would appreciate it. I'm not sure if the code should go in the Form Load or somewhere else, given it does not apply to the detail on every record, only certain records.
  • My alternative which is also acceptable is for the other fields in the same record. I realize that some fields cannot be formatted differently (such as checkboxes), but there are other text boxes / combo boxes in each record.
I have been able to successfully set up the conditional formatting for only one other field in the record. It is working correctly. But the exact same formatting is not working for the other text boxes/combo boxes, and I can't figure out why.

My conditional formatting is set as "Expression Is: [Active]=0".

Any ideas why this is not working for the other fields?

1596885476934.png
 

artemis99

New member
Local time
Today, 19:23
Joined
Jul 5, 2020
Messages
6
Just found a potential solution on another thread about changing the backcolour of a continuous form.

From theDBguy:
The only way to do it is by using conditional formatting on a textbox in the background.
(For some reason the forum is not letting me post the link to the other thread in this forum... I'll have to figure out what I'm doing wrong.)

I think this would work a treat! Just make a textbox large enough to cover the whole record, put it in the back of all the other controls, and make that the only thing with conditional formatting. I'll give it a go.
 

Gasman

Enthusiastic Amateur
Local time
Today, 08:23
Joined
Sep 21, 2011
Messages
14,037
(For some reason the forum is not letting me post the link to the other thread in this forum... I'll have to figure out what I'm doing wrong.)
You need 10 posts before you can post a link?
You can break it up to make normal text should you wish?
 

artemis99

New member
Local time
Today, 19:23
Joined
Jul 5, 2020
Messages
6
You need 10 posts before you can post a link?
You can break it up to make normal text should you wish?
Thank you!! Ok, here is the forum thread where I found the solution (broken up into text):
access-programmers.co.uk/forums/threads
change-backcolour-of-form 308319
#post-1655461 from theDBguy
 

artemis99

New member
Local time
Today, 19:23
Joined
Jul 5, 2020
Messages
6
This worked even better than I expected! It's better than what I was originally looking for, and so easy to implement!
Thanks @theDBguy !!

1596887036229.png
 

artemis99

New member
Local time
Today, 19:23
Joined
Jul 5, 2020
Messages
6
Would still love to know why the conditional formatting was working on some fields and not others...
 

Gasman

Enthusiastic Amateur
Local time
Today, 08:23
Joined
Sep 21, 2011
Messages
14,037
Thank you!! Ok, here is the forum thread where I found the solution (broken up into text):
access-programmers.co.uk/forums/threads
change-backcolour-of-form 308319
#post-1655461 from theDBguy
Actually
access-programmers.co.uk/forums/threads/
change-backcolour-of-form.308319/
#post-1655461
 

Users who are viewing this thread

Top Bottom