To get the SQL query string, open up the document and connect it to the data source for a mailmerge if that hasn't already been done. Having done that, go to Mailings|Edit Recipient List>Filter and apply the requisite filter to the problematic field. The following macro will then tell you, in turn, what are the: Data Source Name; Connect String; and Query String. It's the last of these you need to incorporate into your code - be careful with the direction of any quote characters. You could, of course, output any of these to the end of the document so you can cut & paste any parts you need into your code.
Code:
Sub Test()
With ActiveDocument.MailMerge
If .MainDocumentType <> wdNotAMergeDocument Then
MsgBox "Mail Merge Data Source Name:" & vbCr & .DataSource.Name
MsgBox "Mail Merge Connect String:" & vbCr & .DataSource.ConnectString
MsgBox "Mail Merge Query String:" & vbCr & .DataSource.QueryString
Else
MsgBox "Not A Merge Document"
End If
End With
End Sub