By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,489 Members | 1,945 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,489 IT Pros & Developers. It's quick & easy.

MS Word Mail Merge FindRecord won't find

P: n/a
I want to merge just one record from a query in my Access database into
a Word document. This allows me to send one letter to one client by
first extracting the client's address data, personal data, business
data, and the like.

I get the entire query into the active word document with
..OpenDataSource in a VBA macro.

However, when I try to limit this to one record, the following VBA code
does not work:

ActiveDocument.ActiveWindow.View.ShowFieldCodes = False
ActiveDocument.MailMerge.DataSource.ActiveRecord = wdFirstRecord
If ActiveDocument.FindRecord(FindText:=Filex, Field:="File") = True
Then
numrecord = ActiveDocument.ActiveRecord
End If

Filex has been set to "007" and the query has at least one record where
the field named File = 007.

Nevertheless, numrecord is returned as "0" and the active record
remains the first record.

Also, the line "ActiveDocument.ActiveWindow.View.ShowFieldCod es =
False" does not result in the data being shown - the field codes remain
displayed in the active document.

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Try using my easy word mege here:

Try the sample..as it merges ONE reocrd you are looking at by default...

http://www.members.shaw.ca/AlbertKal.../msaccess.html

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
http://www.members.shaw.ca/AlbertKallal
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.