Solved

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

Posted on 2004-09-30
4
277 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

708 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now