Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mail Merge filter

Status
Not open for further replies.

roltrap

Programmer
Jun 8, 2001
15
0
0
NL
hi,

I want to call a mail merge document in Word using Access. The problem I have is that the filter I use (Therefore I use the code below), doesn't work when I push the Merge button after its generated. It shows all the records. However, when I go to the mail merge menu in Word after the document is loaded from Access, and look at the QueryString, its exactly like the query string I gave in Access. When I subsequently push the Merge button, it does show the documentered filtered. Does someone know how this is possible and how I can get the filter to work directly from Access?

kind regards roltrap

Set WrdApp = CreateObject("Word.Application")
WrdApp.Visible = True

Set wrdDoc = WrdApp.Documents.Open ("d:\projects\wordkoppeling2.doc")

strSQL = "select * from [NAW] where [id] = 122"
WrdApp.ActiveDocument.MailMerge.DataSource.QueryString = strSQL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top