Background Conditional Formatting using a Checkbox

DanKerr

New Member
Joined
Jun 14, 2017
Messages
8
Firstly I would like to apologise, this is my first attempt at creating a form and table for access so my terminology will be off.

We get documents in from customers and I have created a form to "log" and process the documents.

One of the things that I am struggling with though is I have a Checkbox relating to a column in the table called "In Query". I need some sort of conditional formatting so that if the Checkbox is showing as ticked (or yes) then the background of the form will show in a yellow colour.

There is another part to that where I have a date box relating to a column in the table called "Welcome Pack Sent". I need this also to be able to change the background colour to green if filled in but red if filled in with "01/01/2000"

my knowledge of access is very basic. I use VBA a lot in excel but never access, I was hoping there would be some conditional formatting rules rather than macros but any help is appreciated
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
For the change the form yellow, something like the code below would work.

Code:
Private Sub MycheckBox_AfterUpdate()
If Me.MyCheckBox Then
Me.Section(acDetail).BackColor = RGB(241, 233, 81) 'change to the shade of yellow you want
Else
Me.Section(acDetail).BackColor = vbWhite
End If
End Sub

The next part is fairly similar... however, what takes precedence, if the checkbox is ticked is it always yellow?

You would probably want to put code similar to the above into the oncurrent event of your form to ensure it updates as you open a form or cycle through records.
 
Upvote 0
Hi Stumac,

that is great thanks I will give it a shot.

From my experience with excel VBA it looks similar so should be able to sort out the specific ordering of the conditions.

thanks for your help.
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top