Hello
New to Access & having a problem Executing a Word mail merge from an Access button.
I have a Word Doc that I have successfully merged with an Access Query.
Google's AI provoded the following:
To run a Word mail merge from an Access macro, you would use the "DoCmd.TransferDatabase" command, specifying the "Word Merge" transfer type, selecting the desired Access table or query as the data source, and choosing the appropriate Word document to merge with; essentially, exporting your data to Word for mail merge functionality.
Example Access macro code:
Code
DoCmd.TransferDatabase acExport, "Microsoft Word", "YourTableName", "C:\Path\To\YourWordDoc.docx", "Word Merge"
Explanation:
DoCmd.TransferDatabase acExport ,"Microsoft Word","QryMembersTest" , "C:\Users\akram\Documents\FolBkUp\FoL\MMtemp.docx",Word Merge"
So I tried it in the click event of a button but an error indicating Access didn't recognize DoCmd.
Any help appreciated
Al
New to Access & having a problem Executing a Word mail merge from an Access button.
I have a Word Doc that I have successfully merged with an Access Query.
Google's AI provoded the following:
To run a Word mail merge from an Access macro, you would use the "DoCmd.TransferDatabase" command, specifying the "Word Merge" transfer type, selecting the desired Access table or query as the data source, and choosing the appropriate Word document to merge with; essentially, exporting your data to Word for mail merge functionality.
Example Access macro code:
Code
DoCmd.TransferDatabase acExport, "Microsoft Word", "YourTableName", "C:\Path\To\YourWordDoc.docx", "Word Merge"
Explanation:
- DoCmd.TransferDatabase: This is the Access command to transfer data to another application.
- acExport: Specifies that you want to export data.
- "Microsoft Word": Indicates that you are transferring data to Microsoft Word.
- "YourTableName": Replace this with the name of the Access table or query containing the data you want to merge.
- "C:\Path\To\YourWordDoc.docx": Replace this with the full path to your Word document where you want to merge the data.
- "Word Merge": This is the transfer type that initiates the Word mail
DoCmd.TransferDatabase acExport ,"Microsoft Word","QryMembersTest" , "C:\Users\akram\Documents\FolBkUp\FoL\MMtemp.docx",Word Merge"
So I tried it in the click event of a button but an error indicating Access didn't recognize DoCmd.
Any help appreciated
Al