error code 5638 could not parse query options valid query string
This has got me. Not sure if a memory problem in machine or what.
This was all built with macro recorder.
Also I could not open web site from notfication had to go around to get back
to you. All I got was a blank screen.
Thanks for assistance
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 5/24/2008 by Curtiss A. Greer
'
ChangeFileOpenDirectory "C:\Parade\"
Documents.Open FileName:="Letter.doc", ConfirmConversions:=False,
ReadOnly _
:=False, AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate _
:="", Revert:=False, WritePasswordDocument:="",
WritePasswordTemplate:="" _
, Format:=wdOpenFormatAuto
Selection.MoveDown Unit:=wdLine, count:=1
Selection.TypeParagraph
Selection.TypeParagraph
ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
ActiveDocument.MailMerge.OpenDataSource Name:="C:\Parade\ZZZ.txt", _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
Format:=wdOpenFormatAuto, Connection:="", SQLStatement:="",
SQLStatement1 _
:=""
ActiveDocument.MailMerge.EditMainDocument
ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:= _
"Name_of_Entry"
Selection.TypeParagraph
ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:= _
"Contact_Person"
Selection.TypeParagraph
ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:= _
"Address"
Selection.TypeParagraph
ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:= _
"CityState"
Selection.TypeParagraph
ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:="Zip_"
Selection.TypeParagraph
ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:="Amount"
ActiveDocument.MailMerge.datasource.QueryString = _
"SELECT * FROM C:\Parade\ZZZ.txt WHERE ((Name_of_Entry IS NOT NULL )
AND (Contact_Person IS NOT NULL ) AND (Address IS NOT NULL ) AND (City State
IS NOT NULL ) AND (Zip_ IS NOT NULL ) AND (Amount IS NOT NULL ))" _
& ""
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = False
With .datasource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With
CommandBars("Control Toolbox").Visible = False
CommandBars("Stop Recording").Visible = False
End Sub