Can't find & format section of text within a RTF Memo field (1 Viewer)

EdK

Registered User.
Local time
Yesterday, 19:09
Joined
May 22, 2013
Messages
42
Hi!

OK, I am writing a book, based on a large database with the key fields being named "what" and "how".

Because I had the need every so often to quickly find all instances of any (particular) word within the database, without going to the bother of thinking about where that word/subject might be in the data base, I designed a report which does the job nicely.

It uses a search form/control, searches and finds all instances of the word (or words) I have asked it to find, then does a report showing all instances of whatever RTF memo fields that contain the word(s).

It has to be RTF memo field because (if I wish) it goes straight into the book text I'm writing, and also it searches the book's RTF memo field.
.
The trouble is, at present, I then have to manually "eye scan" the resulting report to find the occurrences of the "key searched for" word, nestling/hidden somewhere within sometimes quite large chunks of text.

I would love to have the report show the found "key word(s)" highlighted in (say) light blue or whatever colour, so that I can quickly & easily lock on to it visually.

I'm not very Access savvy but here goes with some particular info ---

I enter the word I want Access to find, into a form called "formfindword" in a text box called Text0. I click on a command box on this form, to open up the report called "Querywhatsandhowschooseword" based on a query of the same name.

The query's "what" field (from the main database) has the criteria

= Like "*" and [forms]![Formfindword]![Text0] & "*"

The query's "how" field criteria (in the "or" line of the query design) is also

= Like "*" & [forms]![Formfindword]![Text0] & "*"

I have tried to use the Conditional Format facility in Report Layout view, without any luck.

I think therefore that I will need some VBA code (which is totally foreign to me, unfortunately) to make this simple concept a reality.

Given the above, can somebody put their minds to the problem and come up with an answer that has some hope of being implemented into my report, however that is to be done ....?

Hope you can follow the detail OK.

I am using MS Access 2007, by the way. And my apologies if this has been covered somewhere else in the forum, I couldn't find it.

EdK
 

James Dudden

Access VBA Developer
Local time
Today, 03:09
Joined
Aug 11, 2008
Messages
369
I've done something similar to this in the past and ended up having to use a table as the basis of the report. So, set up a temp table and when you run your report populate the table using the results from the query. The key here is that the temp table has a memo field in it which the report can then read from.

In your query create a new column and use a replace function to add any formatting e.g. to underline all instances of the word James you would do this:

Replace([MemoFieldName],"James","<u>James</u>")

Then this new column needs to get added to a memo field in your temp table and then in the report as long as the report field is set to rich text it will be able to read the html formatting.
 

EdK

Registered User.
Local time
Yesterday, 19:09
Joined
May 22, 2013
Messages
42
Aha!!! Brilliant/logical/simple!! There is always a way, I guess ..... Thank you so much for picking up on this for me, James. I really appreciate it. Now I just have to put that routine together and get it working and I will be very very happy!! My Access basic skills are lacking so it will be my little challenge for the day (week? month? year? decade?). Thanks again ...

EdK ;)
 

Users who are viewing this thread

Top Bottom