Solved

Export Access Report into Word (without losing the formatting!)

Posted on 2004-09-30
4
282 Views
Last Modified: 2008-02-01
I am trying to export an Access reoport (100+ pages).  I keep losing my formatting, and Word just decides to do all kinds of crazy things with my data, such as different spacing in different areas, and duplicating data.  The only reason that I even want to export to Word is to create a Table of Contents, and an index.  Is there any way to either fix the formatting issue in Word, or create a TOC and index on an Access report?  Thanks a bunch!!
0
Comment
Question by:pmle
4 Comments
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 12193132
Very few Access programmers export from Access reports to Word exactly for that reason.  Perhaps a better idea would be to export your Access reports as snapshot (*.snp) files, then in Word insert them as objects.

Hope this helps.
-Jim
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 12207501
Jim
Could you post the code for opening up a snapshot as an object in word. I've tried the following code that outputs a report selected from a listbox as a snapshot object, inserts it to a word document and attaches the document to an outlook email...and snpshot won't format at all.  The only thing that has come reasonably close to preserving the format has been when I export in rtf format.  My code using snapshot is excerpted below:

             'output value of bound column for selected list item to word
             DoCmd.OutputTo acOutputReport, ctlListBox.Column(0, varItem), acFormatSNP, "c:\Temp\" & ctlListBox.ItemData(varItem) & ".snp", False
             AppWord.Selection.InsertFile "c:\Temp\" & ctlListBox.ItemData(varItem) & ".snp", "", False, False, False
             If i < ctlListBox.ItemsSelected.Count Then
               AppWord.Selection.InsertBreak wdSectionBreakNextPage
             End If
         Next varItem
     
         'create email attachment
         Progress = "Generating Email"
         EventTitle = ctlListBox.ItemData(varItem)
         AppWord.ActiveDocument.SaveAs "c:\Temp\" & EventTitle & ".rtf", wdFormatDocument
         AppWord.ActiveDocument.BuiltInDocumentProperties("Title").Value = "Attached Word File - " & Date
         AppWord.ActiveDocument.Save
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question