Execute a Word mail merge from an access button (2 Viewers)

Al Kramer

New member
Local time
Today, 02:52
Joined
Jan 7, 2025
Messages
13
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: 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
I could not figure out how to enter code with my parameters in a macro:
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
 
Quite a bit of interesting ideas, but did not solve my problem.
Thanx
Al
 
I've never seen the method your attempting and I have no love for A.I. code, so good luck.
 
1. Create a Word template, adding you field names in the places where they need to be
2. Open a recordset with your query
3. For each record, open the Word template from Access
4. Run a Find and Replace routine to find your field names and replace them with their values according to your query
5. Save As another file, leaving the template intact for the next record
6. Done.
 
Last edited:
Show the exact message.
I do not have Word or Word Merge in 2019 ?
 

Users who are viewing this thread

Back
Top Bottom