Using Conditional Formatting to highlight duplicates

robertdseals

Active Member
Joined
May 14, 2008
Messages
334
Office Version
  1. 2010
Platform
  1. Windows
Hello all,
Is there a way to use conditional formatting to highlight duplicates in an Access 2003 report?
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
You don't say if you're interested in duplicates for a field or an entire record. Assuming the first, what comes to mind is:
1) if you can sort on the duplicated field so that they are in order, you could make use of the Hide Duplicates property of a textbox. The trick is to have a textbox BELOW the primary one, bound to the same data field, background colour to be the conditional colour you want, exact same size and position, and the primary control background colour must be the same as the report. This may appear to be white, but the property setting may be a system colour. The Hide Duplicates property setting should hide the primary control and make the secondary one visible, but the duplicates must be in order, AFAIK.

2) for where the data cannot be relied upon to be contiguous, create a temp table and dump the report query into it instead of basing the report on the query. This table needs a count field such as CntOfWhatever (substitute what makes sense to you). Then use a Find Duplicates query on the temp table to get the ID's where count of the field >1. However, I'm suggesting using this fd query as the 'table' for an Update query so you can write the actual counts >1 against the correct id in the temp table. Your report needs a control for the counted field. When it opens, conditional formatting can highlight this control based on the number (>1 yellow, >2 blue, etc.) which you cannot do if your table simply has a Yes/No field instead of a count. Or you can simply colour the textbox if the count field is >1. The caveat here is that any two lines in the report with a coloured control are not necessarily related to each other - it simply means that there is a duplicate of that value somewhere. Grouping and sorting is how you'll have to manage that.

3) anything more complicated than that will probably need a lot of code in the report Format event. Based on my recollection, going that route will require you to use print preview for the report since the format event and report view are not compatible.
 
Upvote 0

Forum statistics

Threads
1,221,825
Messages
6,162,165
Members
451,750
Latest member
dofrancis

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