Summarizing changes to a memo field

  • Thread starter Thread starter Dennis Snelgrove
  • Start date Start date
D

Dennis Snelgrove

Firstly, sorry for posting this here, but I need to do this in Access
and I can't see any other place to post the question and I know it's
going to involve lots of VBA... Now to give a brief description of
where this is coming from.

My office is a 24/7 operation which answers for a variety of different
offices and locations. We use an Access database to store our
procedures and help notes. Primarily the entries consist of a Subject
line and a textbox whose Controlsource is a Memo field. The textbox is
in a monospace font to allow for easy formatting to make the
procedures legible with regard to columns, etc. I've got it set up now
to e-mail a distribution list whenever a procedure content is changed.
Now I've been asked to see if I can make it put a summarization of
what changes were made in the email. Kinda like a "That is the
original content, and this is the new content" thing. I haven't been
given a specific layout as to how this is to be shown, but rather just
to give some sort of a description or summarization of changes. As a
last resort, I could simply put in the complete old content, then
follow it with the new content. However that would leave it to the
mail recipients to compare and locate the changes. That's not what
I've been asked to do, unfortunately. However, I've already gotten it
across that I won't have it considering adding/subtracting spaces or
carriage returns as a change. This would be easy enough to check for;
take the total text for old and new and compare them after removing
all spaces and carriage returns.

As I see it, the biggest problem is that the procedures don't conform
to any given template, so there has to be a generic method of dealing
with this that doesn't depend on a given layout of some sort. I could
do a simple comparison of the two contents character by character, but
this won't work if the new string's length has changed by so much as a
single character. I can't really come up with any other way of doing a
check. Has anyone out there come across code that would even make an
attempt at something like this? Or maybe someone has seen something in
terms of a discussion that would give me a starting point?

The problem is that it's easy to do a comparison when it's a person
scanning it with their eyes. Trying to come up with an algorithm for a
computer is a whole other thing...

Thanks for any suggestions or insights that someone may give...

Dennis
 
When you say old content and new content, how do you know the difference?
Once a user types something in a memo field, it becomes part of the whole.
When and who entered it cannot be determined.
Now, with that being said, you could programmatically work toward that end.
You would have to save a copy of the original before the user does any
editing. Then you could do a comparison; however, you are correct that with
a free form object like a memo field, you are faced with a near impossible
task and, it would slow down the process.
 
Thanks for your response.

Yes, you're right. I would have a Form-level variable that would be
set to the value of the memo field in the OnCurrent event. That way in
the AfterUpdate event, I can test to see if the memo field is the same
as the variable. That will take care of whether there is a change or
not.

Slowing down the process isn't a concern, as long as it's not on the
order of minutes or hours to evaluate and summarize. The procedures
are updated sporadically as needed or at least on an annual basis.
This isn`t something done every day all day long. The idea more or
less is that a procedure gets updated, the changes get summarized and
then emailed to the distribution list that is comprised of all the
people involved in the job.

Thinking about how the human brain handles this easily, it seems that
I`ve got to look at this in terms of pattern recognition. Is there
anything out there that discusses dealing with pattern recognition in
VBAÉ

Thanks...
 
I personally don't have any experience with pattern matching. I would repost
the question focused on that. Also, I would google it using something like
"pattern matching VB"

This is not going to be easy.
 
Back
Top