[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Exporting an Acces Report using VBA

Posted on 2003-12-12
5
Medium Priority
?
1,427 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
  • 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

834 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