Hi Ben,
Working from within Word, you can use the Database field. This runs a
query against a database and insert the results into the text. AFAIK if
the query returns a single value the field can go into running text,
while if there are multiple values (more than one field and/or more than
one record) the field result is a table. Here's a field that queries
Northwind and (if I got it right) returns the mean of the total amounts
of all orders:
{DATABASE \d "C:\\Program Files\\Office
2003\\OFFICE11\\SAMPLES\\Northwind.mdb" \s "SELECT AVG(OrderPrice) AS
AvgOrder FROM (SELECT SUM(UnitPrice * Quantity * (1-Discount)) AS
OrderPrice FROM [Order Details] GROUP BY OrderID);" \# $#,##0.00 }
See also http://word.mvps.org/faqs/interdev/GetDataFromDB.htm
If you prefer to work from Access, you can use formfields or bookmarks
in the Word document and write Access VBA code to poke data into them.
>Hi,
>I have a database on which I am writing several reports. These reports are
[quoted text clipped - 8 lines]
>directly to the word document and refresh from there? Are there any other
>resources you know of which may help me? Cheers in advance. -Ben
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.
Ben - 12 Sep 2005 10:27 GMT
Thanks for your help John. The databse field works perfectly although I am
having some update issues. I have also posted this question in the word forum
with no luck. My problem is that when I update the table by pressing F9 I
lose all of my format changes. Is there any way that I can keep these in
place? I only really need to narrow the columns a little to get the whole
table in my document. Any ideas? Cheers.
> Hi Ben,
>
[quoted text clipped - 33 lines]
>
> Please respond in the newgroup and not by email.
John Nurick - 12 Sep 2005 19:16 GMT
Have you tried using the \* MERGEFORMAT switch in the field? That often
helps, though I don't know whether it will work with a table.
>Thanks for your help John. The databse field works perfectly although I am
>having some update issues. I have also posted this question in the word forum
[quoted text clipped - 40 lines]
>>
>> Please respond in the newgroup and not by email.
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.