Merge Access form/subform fields into Word 2007 document?

D

denilynn

Is it possible to merge Access 2007 form and subform fields into a Word 2007
document?
 
P

Peter Jamieson

Word really works with the underlying data rather than the data sitting on a
particular form (although an Access SQL query can reference "Form" fields,
not just "database" fields, if you issue such a query from Word you have to
be connected to Access using DDE and I don't think you can rely on the
results.

Your best best is probably to put a button on your form that saves the data,
or references to the data in a format that Word can use - for example, you
might export the referenced record(s) to a delimited text file, or save
it/them in a special table in the database, or save the record number in a
special table, etc.
 
P

Peter Jamieson

You may find Albert Kallal's macros at

http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html

do something useful in this area.

--
Peter Jamieson
http://tips.pjmsn.me.uk

Peter Jamieson said:
Word really works with the underlying data rather than the data sitting on
a particular form (although an Access SQL query can reference "Form"
fields, not just "database" fields, if you issue such a query from Word
you have to be connected to Access using DDE and I don't think you can
rely on the results.

Your best best is probably to put a button on your form that saves the
data, or references to the data in a format that Word can use - for
example, you might export the referenced record(s) to a delimited text
file, or save it/them in a special table in the database, or save the
record number in a special table, etc.
 
P

Peter Jamieson

Albert's macro either
a. gets the field names and values that are actually displayed on the form
and export them to a delimited text file. That's if you click the "merge one
record" button, or
b. executes a SQL query that you supply and exports the results to a text
file, if you click "All".

As I understand it, an Access subform will typically be populated with data
that is related to the main form using query syntax that references the
form. e.g. in Albert's sample, there's a query with the text

SELECT Contacts.*
FROM Contacts
WHERE (((Contacts.City)=[forms]![contacts]![city]));

which clearly references a specific form and field on that form.

I think you should be looking to get you data using a similar query, but you
really need to run this type of query within Access while the Form is open,
not from outside Access.

--
Peter Jamieson
http://tips.pjmsn.me.uk

denilynn said:
I have the data that was input into the forms in a datasheet/subdatasheet.
Is
this where I need to begin?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top