Merge data with Word document within Access - How!

I have a query created that writes data to a temporary table.  The table will only have one record ever.  But them somehow within Access I would like to merge that data with a Word template document and print that Word document via a command button on a form.

So basically here are the steps.

1) User clicks a command button on a form.
2) The onclick event of the command button deletes previous data and creates the new table data (I have this working already)
3) The data is merged with the Word document which will reside in the same directory as the front-end file of the Access database.
4) The Word document will print.

And with steps 2-4 happening without the user having to do anything.  Is this possible?
SteveL13Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You can use the MailMerge feature, and you can automate that. The link below is for an older version, but it should still work:

https://support.microsoft.com/en-us/kb/209976

I've also used Bookmarks in the Word document to pinpoint the areas where I wanted to insert data, then opened a recordset in Access, opened my Word document via automation, and then use the Bookmarks collection in that Word object to put the data from my recordset into those bookmarks.

dim rst As DAO.Recordset
Set rst = Currentdb.OpenRecordset("blah blah")

Dim sPath As String
sPath = "Full Path to your Word Document"
Dim wrd As Object
Dim doc As Object
Set wrd = CreateObject("Word.Application")
wrd.Visible = True
Set doc = wrd.Documents.Open(Filename:=sPath, ReadOnly:=True)
'/ writes the bookmark
doc.Bookmarks("CustomerName").Range.Text = rst("Customer_Name")
doc.Bookmarks("CustomerStreet").Range.Text = rst("Street_1")
etc etc

There are numerous resources that show how to use Bookmarks with Word - for example:

http://word.mvps.org/faqs/macrosvba/WorkWithBookmarks.htm

I'll leave it up to you to handle the other stuff - and I would advise you against posting a "project requirement" list like this. Ask the question in "chunks", AFTER you've tried to do the things you're asking for help. Don't just post feature requests like this.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Helen FeddemaCommented:
There are many ways to merge Access data to a Word document.  See my old Four Ways to Merge with Word code sample (written about 1999, but the code still works):

http://www.helenfeddema.com/Files/code24.zip

Or the 4th edition of my Working with Word ebook, which covers Access versions through 2013.  It is available from the Office Watch Website.
SteveL13Author Commented:
To all:  I'll be working on this more tomorrow.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.