Receiving Error 5922, "Word was unable to open the data source" when I run the following VBA code in MS Access:
strSQL = "SELECT * FROM " & "'" & "tbl_Header" & "'"
.MainDocumentType = wdFormLetters
Connection:="TABLE tbl_Header", _
.Destination = wdSendToNewDocument
Basically, I am running MS Access 2016 and I want to automatically create a text file using MS Word MailMerge.
When I run the above code, I get a "Confirm Data Source" pop up box that has "OLE DB Database Files" as the default selection (or I can select MS Access Databases via ODBC).
I have tried numerous variations, but no matter what I try, it always opens the word doc, asks to confirm the Data Source, and gives me an error message that it could not open the Data Source. Also, I am able to open the document manually with no problem; but I need this to work automatically using VBA in MS Access.