?
Solved

Exporting an Acces Report using VBA

Posted on 2003-12-12
5
Medium Priority
?
1,422 Views
Last Modified: 2011-10-03
I'm writing an application in VBA that will produce various reports. For users, there are two options, either printing the report or viewing and editing the report. The first one is easy, the report is based on a table which I fil using sql. For the report to be edited, it needs to be exported to Word. How can I accomplish this from access?

I'm sure it's not that hard but I can't find anything anywhere.

Thanks!
0
Comment
Question by:NeoTeq
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 8

Expert Comment

by:ampapa
ID: 9927532
Take a look at this link: http://www.experts-exchange.com/Databases/MS_Access/Q_20588638.html

Word (.DOC) I don't think is an option for Access though.
0
 
LVL 10

Author Comment

by:NeoTeq
ID: 9927575
RTF is fine, Word can easily be used to edit a file in RTF format. You'd expect Microsoft to offer more support for this kind of thing though. Well thanks for the help so far, I'm going to try to export a report instead of a query and I'm guessing how. If I succeed the points are yours, but any help with it is still appreciated.

-Neo
0
 
LVL 10

Author Comment

by:NeoTeq
ID: 9927638
Ok I guess I really do need help... I can only export a query but not a report? Is that MS logic or am I missing something, hoping for the last :)
0
 
LVL 8

Accepted Solution

by:
ampapa earned 700 total points
ID: 9927851
Give something similar to this a whirl:

DoCmd.OutputTo acOutputTable, "Employees", acFormatRTF, "Employee.rtf", True

From the help file:
The OutputTo method carries out the OutputTo action in Visual Basic.

expression.OutputTo(ObjectType, ObjectName, OutputFormat, OutputFile, AutoStart, TemplateFile, Encoding)

expression   Required. An expression that returns a DoCmd object.

ObjectType  Required AcOutputObjectType. The type of object to output.

AcOutputObjectType can be one of these AcOutputObjectType constants.
acOutputDataAccessPage  Not supported.
acOutputForm
acOutputFunction
acOutputModule
acOutputQuery
acOutputReport
acOutputServerView
acOutputStoredProcedure
acOutputTable

ObjectName  Optional Variant. A string expression that's the valid name of an object of the type selected by the ObjectType argument. If you want to output the active object, specify the object's type for the ObjectType argument and leave this argument blank. If you run Visual Basic code containing the OutputTo method in a library database, Microsoft Access looks for the object with this name, first in the library database, then in the current database.

OutputFormat  Optional Variant. The output format, expressed as an AcFormat constant. If you omit this argument, Microsoft Access prompts you for the output format.

AcFormat can be one of these AcFormat constants.
acFormatASP
acFormatDAP
acFormatHTML
acFormatIIS
acFormatRTF
acFormatSNP
acFormatTXT
acFormatXLS

OutputFile  Optional Variant. A string expression that's the full name, including the path, of the file you want to output the object to. If you leave this argument blank, Microsoft Access prompts you for an output file name.

AutoStart  Optional Variant. Use True (–1) to start the appropriate Microsoft Windows–based application immediately, with the file specified by the OutputFile argument loaded. Use False (0) if you don't want to start the application. This argument is ignored for Microsoft Internet Information Server (.htx, .idc) files and Microsoft ActiveX Server (*.asp) files. If you leave this argument blank, the default (False) is assumed.

TemplateFile  Optional Variant. A string expression that's the full name, including the path, of the file you want to use as a template for an HTML, HTX, or ASP file.

Encoding  Optional Variant.

0
 
LVL 10

Author Comment

by:NeoTeq
ID: 9927910
Already thought it would be something like that... foolish of me not to think of it. Nevertheless, thanks a lot for the quick response, you've saved me a lot of time. And since word is the standard editor for rtf, I don't even have to open an application.

Thanks!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

770 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