Avatar of shelbyinfotech
shelbyinfotech
 asked on

access query results will not show in mail merge document

Query X produces 10 rows. Word Merge shows 10 rows.
Query Y produces 5 rows. Word Merge shows 0 rows.

Query X and Y are same object, just with different criteria.

The

Anyone else seen this happend before ?
Microsoft AccessMicrosoft Office

Avatar of undefined
Last Comment
Simon

8/22/2022 - Mon
Rey Obrero (Capricorn1)

how do you merge "Query Y"?
use the same procedure you used with "Query X"
shelbyinfotech

ASKER
Yes, in fact its the same query, only changing criteria
Simon

Is there any filtering of the data going on withing Word? If the mailmerge document has existing filters they may be excluding all the records returned by Query Y.

It would help if you could describe how your access query results are being used by Word. Are you using the query as the datasource for the merge, or are you passing the query results to Word programatically?

The specific results are being suppressed by a filter in Word is my best guess.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
shelbyinfotech

ASKER
No filters set in Word
ASKER CERTIFIED SOLUTION
Simon

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Rey Obrero (Capricorn1)

upload  a copy of you db
Simon

You might also like to try  this MS Word Macro that prints the datasource fully qualified name and querystring to the immediate window. Useful because Word just tells you the name of the datasource and not the path.
Sub Mailmerge_ListOpenDocsDataSourceAndQueryString()
MsgBox "This lists datasource file path and querystring for each open document to the VBE immediate window", vbInformation
Debug.Print vbCrLf & "Mailmerge_ListOpenDocumentDataSources running @ " & Now()
For Each d In Application.Documents
Debug.Print
d.Activate
If d.MailMerge.DataSource.Name <> "" Then
    Debug.Print d.Name, d.MailMerge.DataSource.Name
    Debug.Print d.Name, d.MailMerge.DataSource.QueryString
Else
    Debug.Print d.Name, "NOT A MAILMERGE DOCUMENT"
End If
Next
Stop
End Sub

Open in new window


To use, go to the Visual Basic Editor in Word, add a new module and then paste this in.

---

If I'm on the wrong track here, please tell us more about how you are doing the merge and how the criteria are set in the queries - are they hardcoded or parameters supplied from a form or elsewhere?
Are both queries in the same database file?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.