Would like to display in report text box crossed out

Hi Experts,

I would like to have the following in a report.
its based on table containing two sets of fields, lets call them FieldA & FieldB.
Now if fieldA = fieldB then text box on report should show only fieldA.
However if both contain data but they are different, then I would like the following displayed.
DataOfFieldA crossed out + space + DataOfFieldB.
Guess this is doable thru drawing a line..
However since this will be used many times in my report, would prefer to have it done the right way. (perhaps utilizing the line method)

Thanks in advance.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Anders Ebro (Microsoft MVP)Microsoft DeveloperCommented:
You could take a look at the code I post here:
TheSmileyCoder: Track Changes, Compare text and highlight difference
It contains a function which produces rich text as output. You can call it directly from a control on your form or report. You can change the formatting if you like, but default is "Red underlined" for deleted text. Rich Text in access doesn't support strikethrough however.
bfuchsAuthor Commented:
Hi Anders,

Thanks for the suggestion.
However this is to be used in a report that gets printed out w/o colors, and therefore I doubt users will accept just the underline as symbolizing a deleted text..
How about the line method, is that possible to be programmed in the format event of detail section for each control needed?

Anders Ebro (Microsoft MVP)Microsoft DeveloperCommented:
You could use the format event to paint a line, using the line method.

But it probably easier to just place a line at design time, and then switch the visibility of it on/off with code in the format event. This will obviously be the easiest should you use Short date format. With long date format, the line would have to be adjusted in length depending on the month name (December being longer than May)

The textbox itself should just be bound to an expression with an iff condition, that produces the text result.
=Iif(DataOfFieldA=DateOfFieldB;DateOfFieldA;DateOfFieldA & " " & DataOfFieldB.)

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

bfuchsAuthor Commented:
Hi Anders,

Just to clarify, this is not meant for date fields, they're all text fields (DataOfFieldA/B) and therefore there is no way to know exactly the length of the text.

Wondering how can I apply the suggested solution?

Anders Ebro (Microsoft MVP)Microsoft DeveloperCommented:
Ahh, sorry missed that. I don't know of a reliable way to produce strikethrough text of variable length. I would still recommend the initial solution I suggested. Its pretty much plug and play.

If you want to put in the effort of modifying the code, it should be possible to support using a different font for deleted text, as opposed to using a red color. You could also opt to use italics instead.
bfuchsAuthor Commented:
Hi Anders,

I started with the line control visible/invisible approach, however users did comment that its crossing thru the entire section..

Any way I can play around with this obstacle?

Was thinking placing another control on top of the line that would be the same text of the original, and that should somehow hide the line...

Anders Ebro (Microsoft MVP)Microsoft DeveloperCommented:
I know of no good reliable way if the data is of variable length.
bfuchsAuthor Commented:
Thank you!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.