Results 1 to 11 of 11
  1. #1
    txacoli is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2010
    Posts
    19

    Can I put a button on a form to create a Mail Merge letter?

    I'm a newbie on Access 2010 and I'm learning fast, but I'm still at a very basic level. I wonder if someone can help me out here please??



    I have a database for my business, which lists clients details. Within this, I have a query that runs off receipts (one customer, many receipts), as I run a private school and people pay me monthly. I use this query to run off a Mail Merge letter within Word, but itīs a royal pain in the neck, having to close the db and open a Word document and then relink it.

    Is there any way that some coding could be used within the db so that I can add a button and just print out that record into a mail merge document? It sounds so easy to me, but I'm a simple soul and from what I've read on the internet, I don't think it's as easy as it should be. Some people have said to use Reports to do this, but I've read and read and I can't find an easy way to do it.

    Please bear in mind when and if you reply that I am a newbie and I don't know coding, so things need describing in step-by-step detail for me

    Many thanks in advance

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529

  3. #3
    Cookie is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Sep 2020
    Posts
    45
    I think that link may now be dead. (http://www.datapigtechnologies.com/f...mailmerge.html) Error 404.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    I've heard great things about Albert's super easy merge:

    http://www.kallal.ca/msaccess/msaccess.html
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    I think that link may now be dead. (http://www.datapigtechnologies.com/f...mailmerge.html) Error 404.
    It seems that Mike Alexander has removed all the DataPig Information. He is no longer active on the Web. No further information is available. It is too bad as he had some great information in his videos and his blog "Bacon Bits."

  6. #6
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Quote Originally Posted by pbaldy View Post
    I've heard great things about Albert's super easy merge:

    http://www.kallal.ca/msaccess/msaccess.html
    I've used this for years and highly recommend it. The mail merge is managed entirely from Access and is indeed very easy to use.
    Although the supplied code is complex, using it is just one line of code: MergeSingleWord
    Don't be put off by Albert's primitive website.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  7. #7
    Cookie is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Sep 2020
    Posts
    45
    Thank you isladogs.

    I thought I would give Albert Kallal's code a shot though I am weaving my way though the code slowly. His sample DB file works as advertised but when you try to incorporate the components into another DB like my Cat Welfare DB project, there are plenty of changes to be made, not to mention a few compile issues. For example,
    where he has the line Dim MyPbar As New clsRidesPBar ' create a instance of our Progress bar. under the Function MergeWord(strDocName As String, in the WordCode, the clsRidesPBar is not recognised. I note he has that as a standard module clsRidesPBar, though the error message suggests it should be a class module.

    It did get some fundamental operation out of it so far but it's still got some debugging to be done.

  8. #8
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Its been a few years since I added Albert's code to a new project but I don't recollect having issues with the supplied code.
    I have used it successfully with several of my commercial apps and with all versions of Access from 2003 through to 365, both 32-bit & 64-bit.

    I did update some of the code and forms to suit my own purposes
    I know there are different iterations of his code on various websites

    In the app I'm looking at now there appear to be 3 modules related to this code:
    a) standard module - modWordCode
    b) class modules - clsProgressBar / clsRidesPBar

    However I've done a search and can't find the code line Dim MyPbar As New clsRidesPBar

    I also don't have a function called MergeWord in modWordCode though I do have functions MergeAllWord & MergeSingleWord
    You must have a different iteration of his code
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  9. #9
    Cookie is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Sep 2020
    Posts
    45
    Than you isladogs,

    I have got it basically working. Still some debugging to do. The code that Albert Kallal made available in the zip package had the GUIProgress form included which was then referred to in other parts of the package. I didn't really find a need for that but in trying to delete reference to it, I may have stuffed up a few things. I keep a things to do list to make sure I stay the course so it allows me to focus on the line relationships across the code in the project. One thing I noticed was that he had a box around the Add New Template, Modify Template, another around Delete Template, another around the OK Merge to Word and Cancel buttons. At one point the Delete button disappeared even through it was still there in design view. There is code covering that behaviour.

  10. #10
    moke123's Avatar
    moke123 is online now Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,643
    @Colin
    MergeWord is about 1/2 down the WordCode module. It includes Dim MyPbar As New clsRidesPBar.
    I wonder if you have a pre-2009 version.

    Alberts wordmerge code is responsible for my addiction to access and vba. I've made many a change to it over the years, mostly to have libraries of documents to better organize them.
    Amazing that it still works flawlessly after nearly 20 years.

    @Cookie
    Be careful what you delete as it can be easy to break his code. There are a lot of calls to various procedures throughout.
    Better to comment out than to delete.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  11. #11
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Hi Moke
    I have two different versions on different apps but neither have that code. As I first used it around 2005, you are probably correct.
    Long ago I also tinkered with the code and modified/modernised his forms
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Button on form needed to run mail merge from query
    By nic79uk in forum Programming
    Replies: 1
    Last Post: 02-17-2012, 07:34 AM
  2. Setting up a mail merge or report letter
    By AndrewsPanda in forum Access
    Replies: 8
    Last Post: 09-29-2011, 05:59 PM
  3. Click a Button to Run Word Mail Merge...
    By nchesebro in forum Programming
    Replies: 6
    Last Post: 03-09-2011, 01:41 PM
  4. Mail Merge
    By Nixx1401 in forum Access
    Replies: 1
    Last Post: 02-15-2010, 10:51 AM
  5. Mail merge
    By grgerhard in forum Forms
    Replies: 0
    Last Post: 04-25-2006, 05:06 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums