473,486 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Conditional formatting in Access Report based on string comparison

1 New Member
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 3451
Rabbit
12,516 Recognized Expert Moderator MVP
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 Recognized Expert Moderator Expert
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
1702
by: Majstor | last post by:
Is it possible to make conditional formatting in report? Thanks. Mario.
5
8943
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
1479
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
8913
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
3157
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
3207
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
2446
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
1508
by: jimmcg | last post by:
how can i limit the records seen in an access report based on a subtotal amount?
13
8426
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...
0
7094
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7173
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6839
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4863
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3066
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.