I'm not sure I'm thinking straight about this one. I'm trying to open a simple query, pull an item, look for it on a Word file and then bold it if it's found. If not move to the next item. I'm not sure I've done the best thing here as I can bold the first instance but no subsequent instances. It is looping through my recordset and finding the items. It's only bolding one instance of the items though. Suggestions?
set db = currentdb
set rst = db.openrecordset ("Q_Violation_Codegroup",dbopendynaset)
rst.movefirst
if not (rst.bof and rst.eof) then
myfindcode = rst!codegroupwordver
wordobj.selection.homekey unit:=wdstory
with wordobj.selection.find
.forward = true
.clearformatting
.matchwholeword = true
.matchcase = false
.wrap = wdfindcontinue
.execute findtext=myfindcode
.forward = true
end with
wordobj.selection.font.bold = true
rst.movenext
loop
end if
set db = currentdb
set rst = db.openrecordset ("Q_Violation_Codegroup",dbopendynaset)
rst.movefirst
if not (rst.bof and rst.eof) then
myfindcode = rst!codegroupwordver
wordobj.selection.homekey unit:=wdstory
with wordobj.selection.find
.forward = true
.clearformatting
.matchwholeword = true
.matchcase = false
.wrap = wdfindcontinue
.execute findtext=myfindcode
.forward = true
end with
wordobj.selection.font.bold = true
rst.movenext
loop
end if