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
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