Conditional Formatting in Access Form

DannyBoyGunner

New Member
Joined
Jul 25, 2018
Messages
6
Hi Everyone,

I've got a DB that's setup to show a list of our all sub-contractors that we use. The main goal is to show details of each subbie and if they meet the approval criteria or not. This way our contracts team only place orders with approved subbies.

The main field is the 'Approval' field that is simply a YES / NO drop-down. Previously we've had simple conditional formatting on this to turn green if YES (approved) and red for NO (not approved). However, now we're wanting to push that a little further and have it reference another field called 'Date Received' which is the date we've taken the data in from the subcontractors. I presume we would setup three slightly tweaked conditional rules with the colour changes for each one and then parameters for the date field altered for each colour.

The additional formatting we're looking for is listed below:

Green – They have been approved (from the drop-list) AND the date in the 'Date Received' field is less than 12 months old

Amber – They have been approved (from the drop-list) BUT the data is between 12 months old and 24 months old and needs renewing

Red – They have not been approved and/or, the data is more than 24 months old and needs renewing and no orders can be placed


If anyone could offer any help that would be greatly appreciated.

Thanks
 
Also I do not think the CF is going to work correctly. If you run this code in the immediate window, you should see the problem.

Code:
dt1=#07/31/2018#
dt2=#09/30/2016#
? datediff("yyyy",dt2,dt1)

datediff("m",dt2,dt1) > 23 would be more accurate, but still not take into account day differences.?
 
Last edited:
Upvote 0

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
You can calculate it on the form using a text box with the following expression (untested)

Code:
=IIf(Nz([Approval],"No")="No" Or DateDiff("yyyy",[Date Received],Now())>1,"Not Approved, Do not use",IIf(DateDiff("yyyy",[Date Received],Now())=1,"Approved but requires updating","Currently Approved"))

Then apply the same conditional formatting rules to this text box as you did with the above.

You should ensure that this same logic is applied if extracting data from the database using a query


Thanks very much for this as it worked a treat. I've handed it over now so will come back if there are any user issues but it does what it was meant to. Thanks again! :-)
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

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