Open Word Document via Access Command Button

loddiemonster

New member
Local time
Today, 09:52
Joined
Feb 4, 2014
Messages
6
I'm new to the forum, but I've been utilizing this website to help with projects. I am "self-taught" in Access, so my knowledge of VBA is minimal at best.

I am creating a database. I have all my forms, queries, tables, reports just as I need them. However, I would like to have a command button on my switchboard that will pull from a query to feed to a Word document (that's actually a letter on my company letterhead). I know a Macro has to be involved with this, but again, I have little to no knowledge of Macros. Also, I would like to be prompted to enter a client ID number when I click on this command button (because I only want to print a letter for a new client, not all of them). Can I do this without getting entangled in VBA or macros? If not, is there a simple way to get around this?

I need help! Any assistance would be greatly appreciated.
 
No, you cannot do this without VBA or a macro.

What exactly are you "feeding" to this Word doc?

The easiest method would be to make a report with the information you need.

The report can be filtered based on the ClientID when the user clicks a button from the form with a simple macro or vba code.

Then, instead of opening the report in Access, it can be outputted to RTF which will open it in Word. I prefer PDF myself but you can do both or either.

All of this involves some basic coding.

Whether this solution will work for you depends on several factors. So, you need to give more information about what you are hoping to achieve.
 
Thanks for responding Myrtle!

The database I have created tracks clients receiving a specialized service. When a new client is entered, there are one of four different letters that is required to mail to them. The form identifies the type letter, so I wrote my query to prompt me to enter the client's unique ID number. That is the query that is linked to the Word document (letter). I thought maybe I could get around the VBA code and/or macros by just placing a hyperlink on my switch board since the letter templates are placed on a shared drive, but that's not working because the it's not pulling the one client ID I'm prompting it for, so... :banghead:!

The information I'm wanting to reflect on the template letters are just basics like name, address, and some other identifiying information that would pertain to that specific client.

What is the option you spoke of regarding the RTF document that would be outputted to Word?
 
There must be a way to transfer the client information directly into the Word template, I just haven't personally done it.

Here is a method I found doing a Google search:
http://www.vbaexpress.com/forum/archive/index.php/t-28627.html

Or you could try the report method. To make the report you will probably need to create a table to store the type and content of the letters and create a LetterTypeID field in your Clients table (assuming each client only gets one letter) or make a junction table.

So, while the report method involves less complex code, it would involve more storing more data and working through structure issues. Plus it would require you to maintain more database objects (at least one extra table, report and query).
 
Also, if you plan to go the report route (which does have it benefits, too) you should export to PDF instead of RTF if you need to include any logos or images of any sort.

I am using Access 2007 and my company logo only shows up when outputted to PDF.
 

Users who are viewing this thread

Back
Top Bottom