Comparing memo fields, and displaying differences

D

Dale Fye

I've got an application where I track changes to a specific memo field,
saving the previous version to a History table. One of my users has asked if
I can create a form where he can pull up the previous version, and the new
version for comparison. Obviously no sweat, so far. But what he really
wants is to be able to look at the form, and see what has changed from the
original to the new version (sort of like tracking changes in word).

My thought is to use a text box set to Rich Text for the latest version, and
compare the two strings word by word, when a difference occurs, insert a html
tag to change the color in the new version. I know this method is frought
with pitfalls, so I was wondering whether anybody has done something similar
and could provide some tips.
 
J

Jack Leach

I'm not sure if you could make it work, but I use a program called WinDiff to
compare two text files. It shows the line numbers/highlights changes, etc.
Pretty handy actually.

I'm thinking maybe you could export the memo to a text file, but I don't
know how you'd get around the lack of word wrapping (maybe to an rft? I'm not
sure if WinDiff works with it)...

Anyway, it might be worth looking into, may save lots of time trying to
re-write a comparison module if no one else has any ideas.

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
J

John Spencer

To do this at all would take a major programming effort.
Highlighting the FIRST change would be simple, highlighting all the changes
would be much more difficult.

For example:
Line one in tableA
Now is the time for good men to come to the party and country [string ended]

Line one in tableB
Nom is the time for all good men to come to the party country and there are
lots more words after this

Changes:
First word Now vs Nom
Do you highlight the WORD or do you highlight the letter.

Word added after "for" so now all words in from word 6 on differ until we get
to Country where the words are in synch again. However note that the string
"good men to come to the party" is not a change.

And All the extended text would be highlighted.

Easier might be to export the strings to two separate Word documents and use
the Word's ability to compare the two strings. Perhaps you could then extract
the compared information and get it into a rich text field/control.

NomNow is the time for all good men to come to the party and country and there
are lots more words after this.

In the above Nom is struck through, Now is underlined, all is struck through,
"and" is underlined, all the trailing words after country are struck through.

Good luck.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
D

Dale Fye

John,

I know! Thus my statement " I know this method is frought
with pitfalls".

For now, my thought is to highlight the word, not the character. I'm still
trying to figure out how to do a strikethrough in an RTF enabled textbox.

I found all sorts of compare text utilities in a web search, but all
appeared to be freeware, or a comercial product. Didn't find any code
examples.

----
Dale



John Spencer said:
To do this at all would take a major programming effort.
Highlighting the FIRST change would be simple, highlighting all the changes
would be much more difficult.

For example:
Line one in tableA
Now is the time for good men to come to the party and country [string ended]

Line one in tableB
Nom is the time for all good men to come to the party country and there are
lots more words after this

Changes:
First word Now vs Nom
Do you highlight the WORD or do you highlight the letter.

Word added after "for" so now all words in from word 6 on differ until we get
to Country where the words are in synch again. However note that the string
"good men to come to the party" is not a change.

And All the extended text would be highlighted.

Easier might be to export the strings to two separate Word documents and use
the Word's ability to compare the two strings. Perhaps you could then extract
the compared information and get it into a rich text field/control.

NomNow is the time for all good men to come to the party and country and there
are lots more words after this.

In the above Nom is struck through, Now is underlined, all is struck through,
"and" is underlined, all the trailing words after country are struck through.

Good luck.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
P

Paul Shapiro

The simplest I can see is to identify the start of the differences (first
character that doesn't match) and the end of the differences (first
character from the right that doesn't match. You could highlight everything
between those 2 locations.

I've thought about this issue before too, and I've considered writing code
to have Word display the differences. It does a nice job, and I don't think
it's nearly as much code to automate Word as it would be to do an equally
good job.

Dale Fye said:
John,

I know! Thus my statement " I know this method is frought
with pitfalls".

For now, my thought is to highlight the word, not the character. I'm
still
trying to figure out how to do a strikethrough in an RTF enabled textbox.

I found all sorts of compare text utilities in a web search, but all
appeared to be freeware, or a comercial product. Didn't find any code
examples.

----
Dale



John Spencer said:
To do this at all would take a major programming effort.
Highlighting the FIRST change would be simple, highlighting all the
changes
would be much more difficult.

For example:
Line one in tableA
Now is the time for good men to come to the party and country [string
ended]

Line one in tableB
Nom is the time for all good men to come to the party country and there
are
lots more words after this

Changes:
First word Now vs Nom
Do you highlight the WORD or do you highlight the letter.

Word added after "for" so now all words in from word 6 on differ until we
get
to Country where the words are in synch again. However note that the
string
"good men to come to the party" is not a change.

And All the extended text would be highlighted.

Easier might be to export the strings to two separate Word documents and
use
the Word's ability to compare the two strings. Perhaps you could then
extract
the compared information and get it into a rich text field/control.

NomNow is the time for all good men to come to the party and country and
there
are lots more words after this.

In the above Nom is struck through, Now is underlined, all is struck
through,
"and" is underlined, all the trailing words after country are struck
through.

Good luck.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

Dale said:
I've got an application where I track changes to a specific memo field,
saving the previous version to a History table. One of my users has
asked if
I can create a form where he can pull up the previous version, and the
new
version for comparison. Obviously no sweat, so far. But what he
really
wants is to be able to look at the form, and see what has changed from
the
original to the new version (sort of like tracking changes in word).

My thought is to use a text box set to Rich Text for the latest
version, and
compare the two strings word by word, when a difference occurs, insert
a html
tag to change the color in the new version. I know this method is
frought
with pitfalls, so I was wondering whether anybody has done something
similar
and could provide some tips.
 
R

ryguy7272

Good one, Jack! Dale, try this:
http://download.cnet.com/Diff-Doc-Professional/3000-2073_4-10208058.html

HTH,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


Paul Shapiro said:
The simplest I can see is to identify the start of the differences (first
character that doesn't match) and the end of the differences (first
character from the right that doesn't match. You could highlight everything
between those 2 locations.

I've thought about this issue before too, and I've considered writing code
to have Word display the differences. It does a nice job, and I don't think
it's nearly as much code to automate Word as it would be to do an equally
good job.

Dale Fye said:
John,

I know! Thus my statement " I know this method is frought
with pitfalls".

For now, my thought is to highlight the word, not the character. I'm
still
trying to figure out how to do a strikethrough in an RTF enabled textbox.

I found all sorts of compare text utilities in a web search, but all
appeared to be freeware, or a comercial product. Didn't find any code
examples.

----
Dale



John Spencer said:
To do this at all would take a major programming effort.
Highlighting the FIRST change would be simple, highlighting all the
changes
would be much more difficult.

For example:
Line one in tableA
Now is the time for good men to come to the party and country [string
ended]

Line one in tableB
Nom is the time for all good men to come to the party country and there
are
lots more words after this

Changes:
First word Now vs Nom
Do you highlight the WORD or do you highlight the letter.

Word added after "for" so now all words in from word 6 on differ until we
get
to Country where the words are in synch again. However note that the
string
"good men to come to the party" is not a change.

And All the extended text would be highlighted.

Easier might be to export the strings to two separate Word documents and
use
the Word's ability to compare the two strings. Perhaps you could then
extract
the compared information and get it into a rich text field/control.

NomNow is the time for all good men to come to the party and country and
there
are lots more words after this.

In the above Nom is struck through, Now is underlined, all is struck
through,
"and" is underlined, all the trailing words after country are struck
through.

Good luck.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

Dale Fye wrote:
I've got an application where I track changes to a specific memo field,
saving the previous version to a History table. One of my users has
asked if
I can create a form where he can pull up the previous version, and the
new
version for comparison. Obviously no sweat, so far. But what he
really
wants is to be able to look at the form, and see what has changed from
the
original to the new version (sort of like tracking changes in word).

My thought is to use a text box set to Rich Text for the latest
version, and
compare the two strings word by word, when a difference occurs, insert
a html
tag to change the color in the new version. I know this method is
frought
with pitfalls, so I was wondering whether anybody has done something
similar
and could provide some tips.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top