Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Jan 2001
    Location
    Duesseldorf, Germany
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Export a report to Word (Acc2002)

    I would like to export a report created in preview mode via VBA Code programmaticaly . I would like to use the same functionality as with the "Publish with Word" Button. I only need to define the target filename. Any hints?

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Export a report to Word (Acc2002)

    You could use
    DoCmd.OutputTo acOutputReport,"ReportName", acFormatRTF, "FileName.rtf",False
    Francois

  3. #3
    Star Lounger
    Join Date
    Jan 2001
    Location
    Duesseldorf, Germany
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Export a report to Word (Acc2002)

    Does this use the report with its current selection (I open the report using a where-clause to select only a subset of pages)? I need to run that in a cycle of 30 Reports with a different selection on every report.

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Export a report to Word (Acc2002)

    You could set the where part in the On open event of the report as a filter.
    <pre>Me.Filter = "[someField] = " & something
    Me.FilterOn = True</pre>


    Something can be a global variable or a form field.
    If it is a string don't forget the quotes
    <pre>Me.Filter = "[someField] = '" & something & "'"</pre>

    If it is a date use #
    <pre>Me.Filter = "[someField] = #" & something & "#"</pre>

    Francois

  5. #5
    Star Lounger
    Join Date
    Jan 2001
    Location
    Duesseldorf, Germany
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Export a report to Word (Acc2002)

    Tried it. Works pretty well.
    Thanks a lot. <img src=/S/bravo.gif border=0 alt=bravo width=16 height=30>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •