Full Version: Button to generate Word documents
UtterAccess Forums > Microsoft® Access > Access Forms
sherri_k
OK, I have a number of existing databases which with the kind hep of UA members I have managed to configure so that on the click of a button from a form in Access, the user can create, populate and save a word document which takes data from the form concerned.
now need to know whether it is possible to take this one step further?
I have created a new database with a SQL back end and a MS Access front end.
It is to be used as a customer management database and for each new customer we take on, they may potentially have a number of our products and generally we issue a welcome pack which contains information specific to the customer and to their products/setup/configuration etc etc.
I am trying to create a set of template welcome pack documents which essectially I will want part populated from data held in the database (which could be spread across a number of different database tables).
The issue is going to be that the form containing the button that I plan to generate the welcome pack documents from will not store all of the output data required for the welcome pack documents that I wish to generate from it. Although the tables are linked via a record referencing system, I will need to use Access queries and/or SQL views to generate the welcome pack content for each customer.
So basically, my initial question is (and sorry to have gone the long way around asking it), is it possible to use a button on an Access form to open, populate and store a number of Word documents if the dat required in those documents is not actually held in the form (or associated table) concerned by making use of queries/views within the button code?
fkegley
Yes, that can be done. For instance,
urrentDb.Execute "NameOfActionQueryOrSQLStatementGoesHere", dbFailOnError
would be one way, an Action query would most likely in your situation move the data to a temporary table, which could then be used as the source of the data for the Word form.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.