Forum Discussion
Windows 11 Anomaly with VBA Mailmerge
hi
We have Office365 desktop apps on all computers ,running latest version of Microsoft Access
We have an internal system written on Microsoft Access which uses vba code and Microsoft Word Mail merge templates and an ODBC 64 bit MS Access Data source to facilitate multiple mailmerge document creation
The code is actually looping though doing about 20 mailmerge documents
Only problem is it only works on Windows 10 computers ,it does not work on Windows 11 ??? ,(Office Configuration and ODBC is identical) it crashes after doing about 10 successful mailmerges. It gives the error message 5922 at this point in the code
objDoc.MailMerge.OpenDataSource Name:=strDBPath, _
LinktoSource:=True, _
Connection:="DSN=workgroupname;", _
SQLStatement:="SELECT * FROM " & strQueryName
.Destination = wdSendToNewDocument
objWord.DisplayAlerts = wdAlertsNone
the next line of code which it does get to is
.Execute
Any help at all on what this would be very gratefully received
- George_HepworthSilver Contributor
ian91827 After a quick search on error code 5922, I turned up this related discussion from a few years ago.
It sounds like there may be problems in the way the connection to Word is crafted. Perhaps start over with the suggestion contained in that link.
Also, make sure that all of the records in the recordset being sent to the Word mailmerge are acceptable to it. Given the fact that some records are sent out via mailmerge, but others aren't suggests some issue with the data. When it's an all-or-nothing problem, we look more to code or to environment. When it's a random problem like this, we look first to data.