Conditional Formatting from a Table (1 Viewer)

MattBaldry

Self Taught, Learn from the Forums
Local time
Today, 13:26
Joined
Feb 5, 2019
Messages
309
Hi all,

Is there a quick way of creating a conditional formatting style method but with the options added/selected in a table.

We have 4 production cells, and each are assigned a colour. At the moment I have created conditional formatting rules to change the colour on my continuous form. What I would like would be to be able to use a table to add new Cells and colours or change existing ones.

~Matt

1716462455323.png


1716462593988.png
 

bob fitz

AWF VIP
Local time
Today, 13:26
Joined
May 23, 2011
Messages
4,731
I would be surprised if you could apply conditional formatting to a field at the table level, after all, tables are for storing data, not for viewing.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 13:26
Joined
Feb 19, 2013
Messages
16,743
You can use vba to set conditional formatting referencing a table or if the control is a text box you can use sql to create a rich text field in your form recordsource formatted how you require although that does relate more to the text rather than a control back colour

with regards your second image, create an unbound text box sized to the detail section and send to back. You then only need to conditionally set this control, not all of them
 

MattBaldry

Self Taught, Learn from the Forums
Local time
Today, 13:26
Joined
Feb 5, 2019
Messages
309
You can use vba to set conditional formatting referencing a table or if the control is a text box you can use sql to create a rich text field in your form recordsource formatted how you require although that does relate more to the text rather than a control back colour

with regards your second image, create an unbound text box sized to the detail section and send to back. You then only need to conditionally set this control, not all of them
Thanks CJ,

I did think of this, but on some of them I need to change the font colour to white, so it is not just the background of the text boxes. I will have a look into it though and see if I can always leave the text in 1 colour.

The current record is highlighted black with white text, and some of the others also need white text to be clearly seen by us colour blind people :(

~Matt
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 08:26
Joined
May 21, 2018
Messages
8,700
See demo, does exactly that. This stores the background colors in a table for a category and creates the format condition. Simply add an new forecolor field in the table. Should require just two additional lines of code to be able to dynamically add and modify your format conditions from the table.

You can disregard the discussion on the onpaint event and focus on the adding and removing format conditions.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 13:26
Joined
Sep 12, 2006
Messages
15,755
With respect to colours I always found white forecolours hard to use. I ended up using black on yellow and black on cyan predominantly. One issue is there are very few vbcolour constants that are available. So vbYellow and vbCyan were ok, but not much else. I didn't like white on blue, red or green. Maybe better monitors make a difference.
 

Gasman

Enthusiastic Amateur
Local time
Today, 13:26
Joined
Sep 21, 2011
Messages
14,626
When I was using a DOS command window, I used to prefer yellow on blue.
 

Users who are viewing this thread

Top Bottom