Background Color on a Continuous Form - based on Boolean (1 Viewer)

MatthewB

Member
Local time
Today, 05:05
Joined
Mar 30, 2022
Messages
85
I have a continuous list with a field (boolean) [Completed]. When I check it the conditional colour changes. This produces a visual sort of task completed. It only works if background colour of my [Background] field is 'Solid', not 'Transparent'. So I need to write an Expression that says, [Completed] = True, make field 'Solid'. How can I do this??

Thanks
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 20:05
Joined
May 7, 2009
Messages
19,248
on design view of your continuous form set the [background] textbox's Back Style to Normal.
right click on the textbox and set it's Position to Send To Back.
 

MatthewB

Member
Local time
Today, 05:05
Joined
Mar 30, 2022
Messages
85
on design view of your continuous form set the [background] textbox's Back Style to Normal.
right click on the textbox and set it's Position to Send To Back.
Yes, that does not work.
To clarify.
A continuous form has a property that allows one to alternate the row background colour. This is for ease of reading.
If I create a 'Background' field and size it to the row the alternate property is lost. So it seems to me I need to write a code that makes the Background field property change from 'transparent' to 'solid' based on the conditional formatting. I am not experienced with how to set a property value through code.
Thanks
 

isladogs

MVP / VIP
Local time
Today, 13:05
Joined
Jan 14, 2017
Messages
18,240
Do you mean something like this?
1660558850575.png


See my example app:

The coloured section is just a textbox control and can be widened to fill the entire row then placed at the back of the z-order
1660559223522.png
 

MatthewB

Member
Local time
Today, 05:05
Joined
Mar 30, 2022
Messages
85
Do you mean something like this?
View attachment 102514

See my example app:

The coloured section is just a textbox control and can be widened to fill the entire row
Do you mean something like this?
View attachment 102514

See my example app:

The coloured section is just a textbox control and can be widened to fill the entire row then placed at the back of the z-order
View attachment 102515
I create a simplified version of the form. It works here but in my actual database when the Background field property is 'Back Style' Normal the field covers the alternating background of the continuous form.

Thanks
 

Attachments

  • Database2.accdb
    452 KB · Views: 120

isladogs

MVP / VIP
Local time
Today, 13:05
Joined
Jan 14, 2017
Messages
18,240
Is there a reason why you've uploaded your database or a follow up question?
 

MatthewB

Member
Local time
Today, 05:05
Joined
Mar 30, 2022
Messages
85
Yes. In the example db I provided the concept works. When I try the same setup on the db proper it does not work. I cannot understand why.

I have noticed is that the concept works if I make the BackgoundColour field property Back Style - 'Normal'. Then my conditional formatting [BackgroundColour]=True renders the Text Box to a selected colour. If I make the Back Style - 'Transparent' the conditional formatting does not work. So my question, is there a script I can use to make the Back Style property 'Normal' if the Expression is [BackgroundColour]=True?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 20:05
Joined
May 7, 2009
Messages
19,248
Back Style property 'Normal'
backstyle should always be Normal.
remember it is Continuous form and there is only 1 "background" textbox.
applying Property to this textbox will appear to All "background" textbox.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 13:05
Joined
Sep 12, 2006
Messages
15,658
In the form design of a continuous form, there is only one row, repeated.
So the back style of the FORM is either solid or transparent, and a set colour, and that affects the whole form, other than the "special" alternating rows setting.

What you need is have a single label or text box running the width of the from.
In conditional formatting you can set that control for each row separately to visible/not visible or transparent/not transparent , and vary the colour, based on the data.

I am pretty sure that's what @isladogs did in his colourful example above, and he and others are explaining.
 

MatthewB

Member
Local time
Today, 05:05
Joined
Mar 30, 2022
Messages
85
In the form design of a continuous form, there is only one row, repeated.
So the back style of the FORM is either solid or transparent, and a set colour, and that affects the whole form, other than the "special" alternating rows setting.

What you need is have a single label or text box running the width of the from.
In conditional formatting you can set that control for each row separately to visible/not visible or transparent/not transparent , and vary the colour, based on the data.

I am pretty sure that's what @isladogs did in his colourful example above, and he and others are explaining.
Okay thanks GTH

Let me add. If I set the Form![BackgroundColour].Back Style = Transparent , the conditional formatting (which changes [BackgroundColour] to the specified colour based on the state of the boolean Form![Completed]) does not show the colour. Presumably this is because the Property is Form![BackgroundColour].Back Style = Transparent . That is why I ask, how to insert a line of code that reads to the effect of;

Form![BackgroundColour]
If for the record
[Completed] = True
then for the record
[BackgroundColour].Back Style = Normal

and then

[BackgroundColour].Back Color = #77C0D4

The logic here is that for the record where the boolean is True the properties are set accordingly.

I looked at Isladogs db example but I do not see how this is relevant to the conditional formatting I am looking for. Presumably this is because I am a Novice to VBA coding.

Thanks again.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 13:05
Joined
Sep 12, 2006
Messages
15,658
Form![BackgroundColour]
If for the record
[Completed] = True
then for the record
[BackgroundColour].Back Style = Normal
[BackgroundColour].Back Color = #77C0D4
I am pretty sure you can't do that for the form. The form is displayed to you (in design mode) as a single row, and all rows of a continuous form take the same properties, so if you change the properties of the form, it changes the whole form. There is no "conditional formatting" option for the form itself.

For the form it will be either me.backcolor, and me.backstyle. "me" here refers to the current form instance.
For a section of the form (header, detail, footer) it will be me.section("detail").backcolor, and me.section("detail").backstyle
The syntax may not be precise.

So you can show the backcolor of the header and footer as white, and the backcolor of the central detail section as a pale green, say.

To show each row differently, you need a control on the form and you can then apply conditional formatting to the control as displayed on each row. It's not done in code - it's done in the form design. You right-click the control, and then choose conditional formatting.
 
Last edited:

Users who are viewing this thread

Top Bottom