Fining keywords

P

Pooley

Hi

I have two tables and on the output of data from one of them, I want to
search for matching words in the other - similar to how see searches that
display your search term in bold within the results.

So, the main table that will be accessed is the News table and as it is put
out to screen I want it to find any occurrences of anything in my table of
StaffNames so that I can dynamically link occurrences of those staff names
to that staff's profile.

I know about Instr and I know about Replace but I cannot figure a way to do
this without a huge calculation (i.e. looping through every entry in the
StaffNames tables for every word in the News table which would be very
intensive).

Assuming that my StaffNames tables contains, say, 100 names. I suspect I
need to start by putting those names into an array and then checking against
that as I output the News recordset, but I don't know how to check the value
of a recordset against each value within a 100 part array in order to do a
Replace in this way.

Please could someone suggest a way to do this? Thanks.
 
A

Anthony Sullivan

Pooley,

Try this...

while not RS.EOF
for i = 0 to UBOUND(arrWords)
if instr(0, RS(0), arrWords(i)) then
' Do Stuff
end if
next
RS.moveNext
wend

Hope this helps!
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top