Exporting an Acces Report using VBA

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!
LVL 10
NeoTeqAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ampapaCommented:
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
NeoTeqAuthor Commented:
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
NeoTeqAuthor Commented:
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
ampapaCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NeoTeqAuthor Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.