473,385 Members | 1,934 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Conditional formatting in Access Report based on string comparison

Hi,

I'm having problems finding a way to apply conditional formatting based on comparing the text contents of two fields in two different tables.

What I'd like to do:
I've got two tables that are identically structured with about 50 fields each. The two tables are used for two data inputters to independently enter the same data from the same source as part of a validation check. I want to be able to check which if any fields are different across the two tables for each. I have therefore created a report that has each field from the two tables adjacent to each other so that I can visually compare them. This would be much easier if I could highlight only the ones that are different.

Database details:

Windows 7, Access 2013
The two tables I'm comparing are [Data extraction - final reconciled] and [Data extraction - Tazeem]
These have a one-to-one join using their primary key - [EPPI ID]
I've created a query that selects all fields in both tables, joined on [EPPI ID].
I've then created a report based on this query (which if it makes a difference has two subreports in it).

What I've tried:
I've tried various ways of comparing the two fields using conditional formatting based on an Expression, e.g. for the field [Unit of allocation - details] I've tried the following individual expressions:
Expand|Select|Wrap|Line Numbers
  1.  [Data extraction - final reconciled]![Unit of allocation - details]<>[Data extraction - tazeem]![Unit of allocation - details]
Expand|Select|Wrap|Line Numbers
  1. StrComp([Data extraction - final reconciled]![Unit of allocation - details],[Data extraction - tazeem]![Unit of allocation - details],1)<>0 
Expand|Select|Wrap|Line Numbers
  1. [Data extraction - final reconciled]![Unit of allocation - details] In ([Data extraction - tazeem]![Unit of allocation - details])=0
Expand|Select|Wrap|Line Numbers
  1. InStr([Data extraction - final reconciled]![Unit of allocation - details],[Data extraction - tazeem]![Unit of allocation - details])=0

None of these work when I use them as a conditional formatting rule in the report, yet they all return the values I expect when I add them as alias fields to the query the report is based on.

Any ideas why?

Also, as there are about 50 odd fields that I need to compare and would rather avoid clicking on each to set the conditional formatting, is there some code that will do this automatically for all fields in the report?

Any advice really appreciated!

Thanks,

Fred
Apr 17 '15 #1
2 3436
Rabbit
12,516 Expert Mod 8TB
Any ideas why?
I assume you're using the query for the source of the report. You need to reference the fields in that query. You can't reference a table that's in a query.

Also, as there are about 50 odd fields that I need to compare and would rather avoid clicking on each to set the conditional formatting, is there some code that will do this automatically for all fields in the report?
You can set them all at once by selecting them all. But the condition for them all would be the same. It sounds like you want the condition to be different each time and you can't do that automatically because there's no way for it to know what the condition will be.
Apr 17 '15 #2
zmbd
5,501 Expert Mod 4TB
A thought.

Tbl1 left join Tbl2 on each field
Or() conditional for isnull() on each field
So, if any one of the fields does not match between the two table, then only those records are reported in the query. That alone should reduce your eyestrain :-)

Now if one could take the conditional formatting for each control such that if:
[nameofcontrol_1_a] <> [nameofcontrol_1_b]then format.

You would have to set the conditional for each pairing
[nameofcontrol_2_a] <> [nameofcontrol_2_b]then format.
[nameofcontrol_3_a] <> [nameofcontrol_3_b]then format.
etc...

Another thought...
One data entry table, which sound a tad un-normalized.
One data table for the verification - same format at tbl1 however only one record.
Form for the primary data entry.
Form for verification two subforms
2nd-User selects record in subform1 which is read-only
2nd-User enters data into subform2 on change event compares the field to the current-record in subform1. If not match then force 2nd-User to re-enter and confirm or abort, the change is made to tbl1 re-query the subform1 and reselect the record change is noted in log table for later review.
2nd-User selects new record subform1, tbl_verifcation fields are set to null subform2 required to update.
Some kinks to work out in the above.
Apr 17 '15 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Majstor | last post by:
Is it possible to make conditional formatting in report? Thanks. Mario.
5
by: Andrew Chanter | last post by:
Does anyone know a way you can use conditional formatting to create a banded style view as is commonly seen on the internet. (In othe words the first record appears on a gray background, the 2nd...
1
by: A49553 | last post by:
I am trying to e-mail reports from Access that are based on pass-through queries going to an Oracle database. I am using Access 2003 on a Windows XP OS. I was able to e-mail these on my previous PC...
4
by: slinky | last post by:
Thanks in advance... I have a continuous style form with a field for each record called "STATUS". I simply want to have the form load and if the value of the textbox is "Inactive" I want the...
3
by: LostBoy | last post by:
Hi All, I have a couple Date fields in a form that are usually Null but when they are not I would like the field to be highlighted, bold and flash. I usually right click on the field and go to...
13
by: masteraccess2008 | last post by:
I create in Access report based on user defined function(UDF) in SQL Server which returns table. CREATE FUNCTION MyFunc_VP (@VP varchar(12)) RETURNS TABLE AS RETURN (SELECT...... In Access,...
4
by: GregKrajacic | last post by:
My report: Reports chronologically end-to-end milestones of my project. My objective: "Grey Out" from left-to-right to the last completed milestone(ie. Is Not Null.) My problem: I have VBA to...
4
by: jimmcg | last post by:
how can i limit the records seen in an access report based on a subtotal amount?
13
by: liztowne | last post by:
I'm putting together a report (a very simple one) where I'm grouping by crime type (all, violent, property), displaying city and district data with percent change. I need to format the field...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.