Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outputting reports to Word

Status
Not open for further replies.

vivian

Technical User
Mar 14, 2000
6
US
How can I output several Access reports or queries to the same word file? Is there a way to append to an existing file? I have been using DoCmd.outputto acoutputQuery,&quot;my query&quot;, acformatRTF, &quot;filename.rtf&quot; true but this will not let me output anoher query to the end of the same file<br>
I would appreciate any help<br>
<br>
Thanks<br>
<br>
VS
 
Well since Word is set up to merge to 1 datasource its hard to have multiple's in one document.<br>
You can however have several Word docs and link each to a separate query.<br>
And make a Macro that opens all of them.<br>
<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
I suppose your reports are manuy pages long<br>
With that amount of data you are talking about.<br>
So create several each Doc that does a specialzed thing.<br>
Each Doc is connected to just one query.<br>
<br>
OK <p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
In the end I will need to generate about 600 different documents, each having the same type of reports and charts which are about 30 alotogether. Are you sure there is no way to append the reports to one document. This sounds very elementary. Thanks for your help<br>
Vivian
 
If you are referring to saving charts created in Access to a rich text format file it will not do that. You can save the report but you will lose any charts and other graphics created in the report. The only way to maintain the original graphic format of your reports is to save them with the snapshot format and then view them with the Microsoft Snapshot Viewer.<br>
<br>
Mike<br>
<br>
<A HREF="mailto:michaelj1@home.com">michaelj1@home.com</A>
 
I don't understand what the Access Snapshot Viewer does. All I want is to be able to print a document that has several reports produced in Access in it. I can do this by cutting and pasting but isn't there a programmatic way in Access to append to files. I noticed the open statement that opens a file in different modes such as append, but I don't know how to write into it.
 
If you have an Access report made (or many made), and you want to just print it (them) out in 1 report, there is an easier way to do it than cut-n-paste. But it requires Acrobat PDFWriter. This allows you to append to the end of an existing .pdf file (or create a new one). this would be the same as exporting to Word, except you will not be able to edit it in .pdf<br>
This may take some figuring out of the coding to do it directly with Access, but if you can't do it to Word, this is a route that you can take.<br>
<br>
<p>Brian Famous<br><a href=mailto:bfamous@ncdoi.net>bfamous@ncdoi.net</a><br><a href= > </a><br>
 
Does it have to be RTF?<br>
You can append ASCII files together?<br>
<br>
Using the &quot;open&quot; statement<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
Brian,<br>
Thanks for the tip re ACrobat. Can you tell me where I can find information about the coding and linking acrobat to access?<br>
Thanks<br>
<br>
Doug,<br>
I'm sorry I didn't understand your last comments and wasn't sure if you were asking me questions.
 
The Microsoft Snapshot Viewer enables you to view a report snapshot without having Microsoft Access 97 or Microsoft Access 2000 or the run-time version of Microsoft Access 97 or Access 2000 on your computer. It also keeps all of your graphics intact exactly as they appear in an Access report. Anyone can download it to their computer and then you can send them the Snapshot file for viewing and printing.
 
First you have to have the ability to Print to Acrobat PDFWriter (this part is not the freeware)<br>
<br>
you'll have to have Access open up Acrobat, bring the report up and append it to the end of your existing file by saving it to the same file (this may have to be done manually unless you can figure out a macro that gives Acrobat the command to save and where).<br>
<br>
As for the actual coding, this would be something to the likes of:<br>
<br>
Dim AcroPath, DocPath As String<br>
Dim Retval As Variant<br>
AcroPath = &quot;C:\Acrobat\Adobe.exe&quot;<br>
'or whatever the path and name of your Adobe .exe file is<br>
DocPath = &quot;c:\YourDocNameAndPath.doc&quot;<br>
Retval = Shell(WordPath & &quot; &quot; & DocPath, vbMaximizedFocus)<br>
<br>
<br>
this will open Acrobat and bring up your report, then you must have it append your new pages to the end of it.<br>
<br>
that's about all i can really give you from the top of my head. maybe if you give more feedback about your actual names, paths and reports i or someone else could help some more.<br>
<br>
thanks. <br>
<p>Brian Famous<br><a href=mailto:bfamous@ncdoi.net>bfamous@ncdoi.net</a><br><a href= > </a><br>
 
Thanks Brian for your help. How would I get the ability to print to Acrobat? What would I need to install it? Also what kind of information about the reports can I give you if you were to help me out a bit more. I appreciate your time and effort. Also is it absolutely impossible then to do this from Access to Word? what about the open statement that has an &quot;append&quot; mode? is it at all applicable to my situation?<br>
Thanks again<br>
vivian
 
To print to acrobat you'd have to purchase the Adobe software (i'm not sure of the cost), i'm sure you could find them on the web really easily.<br>
i wouldn't completely rule out doing it to Word though, going with something like the two of these methods you might be able to figure something out.<br>
<br>
Dim WordPath, DocPath As String<br>
Dim Retval As Variant<br>
WordPath = &quot;C:\program files\microsoft office\office\winword.exe&quot;<br>
DocPath = &quot;c:\YourDocNameAndPath.doc&quot;<br>
Retval = Shell(WordPath & &quot; &quot; & DocPath, vbMaximizedFocus)<br>
<br>
this opens word and your document and you may be able to append to it this way, or<br>
<br>
<br>
Dim oApp As Object<br>
Dim objWord As Object<br>
Dim report1 as string<br>
dim report2 as string<br>
<br>
report1 = &quot;Your1stReport&quot;<br>
report2 = &quot;Your2ndReport&quot;<br>
<br>
Set oApp = CreateObject(&quot;Word.Application&quot;)<br>
oApp.Visible = True<br>
Set objWord = CreateObject(&quot;Word.Basic&quot;)<br>
objWord.FileNew<br>
'creates a new document which you can then use <br>
<br>
<br>
objWord.Insert report1<br>
objWord.InsertPara 'inserts a space<br>
objWord.Insert report2<br>
<br>
etc...<br>
<br>
you may have to Dim the report names and such, but you can take a look at this method.<br>
depending on your report formatting and all it may work, or it may be a hassle. this is something that i've been playing with lately, so if i figure the exact logistics out i'll let you know. i'll be away until Monday (going to Savannah,Ga for St. Patty's day) but will be back and willing to help if you still need it then.<br>
<br>
<br>
good luck<br>
<p>Brian Famous<br><a href=mailto:bfamous@ncdoi.net>bfamous@ncdoi.net</a><br><a href= > </a><br>
 
actually, the second one should probably be<br>
<br>
Dim oApp As Object<br>
Dim objWord As Object<br>
Dim report1 as report_Your1stReport<br>
dim report2 as report2_Your2ndReport<br>
<br>
<br>
Set oApp = CreateObject(&quot;Word.Application&quot;)<br>
oApp.Visible = True<br>
Set objWord = CreateObject(&quot;Word.Basic&quot;)<br>
objWord.FileNew<br>
'creates a new document which you can then use <br>
<br>
<br>
objWord.Insert report1<br>
objWord.InsertPageBreak 'inserts a page break<br>
objWord.Insert report2 <p>Brian Famous<br><a href=mailto:bfamous@ncdoi.net>bfamous@ncdoi.net</a><br><a href= > </a><br>
 
Thanks a lot Brian, I'll see how I can figure things out, and I'll take you on your offer for more help when you come back. <br>
Have lots of fun<br>
Vivian
 
Vivian -- Please contact me at <A HREF="mailto:deb.koplen@telops.gte.com">deb.koplen@telops.gte.com</A>.&nbsp;&nbsp;I would like to find out what happened since you last posted. <p>Deb Koplen<br><a href=mailto:deb.koplen@telops.gte.com>deb.koplen@telops.gte.com</a><br><a href= > </a><br>A person can stand almost anything except a succession of ordinary days.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top