Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2002
    Location
    VA
    Posts
    24

    Unanswered: Output Report to a file

    Hi Everyone,

    I was wondering if someone can help me in outputting a report to a file. this is what i have so far

    Dim stDocName As String

    stDocName = "OPS"
    Dim strOutputFormat As String
    strOutputFormat = "Snapshot Format"
    DoCmd.OutputTo acReport, stDocName, strOutputFormat

    I was wondering when I'm sending that report if I can set criteria to the output file. For Example, the report called ops need to send only information on a Division called Division1 not all of the division. Is there a way I can set a filter when outputting this report to a file for historical purpose.

  2. #2
    Join Date
    Nov 2002
    Location
    San Francisco
    Posts
    251
    The easies way is to have your report pointed to a query. Then before you run the report, simply change the query.... then export the report and change the query back....

    strOLDSQL = Currentdb.QueryDefs("myQuery").SQL
    Currentdb.QueryDefs("myQuery").SQL = "SELECT * FROM myTable WHERE Division = 333"

    stDocName = "OPS"
    Dim strOutputFormat As String
    strOutputFormat = "Snapshot Format"
    DoCmd.OutputTo acReport, stDocName, strOutputFormat

    Currentdb.QueryDefs("myQuery").SQL = strOLDSQL


    you can also change the recordsource of the report, but this is easier...



    jiri

  3. #3
    Join Date
    Nov 2002
    Location
    VA
    Posts
    24

    Re: Output Report to a file

    Thanks Playernovis for the advice. let me give it a try. the bad thing about my report is that it consist about 6 extra report. don't ask me why, the customer wanted these information on one page you know how it is. Thanks again





    Originally posted by sopheapteng
    Hi Everyone,

    I was wondering if someone can help me in outputting a report to a file. this is what i have so far

    Dim stDocName As String

    stDocName = "OPS"
    Dim strOutputFormat As String
    strOutputFormat = "Snapshot Format"
    DoCmd.OutputTo acReport, stDocName, strOutputFormat

    I was wondering when I'm sending that report if I can set criteria to the output file. For Example, the report called ops need to send only information on a Division called Division1 not all of the division. Is there a way I can set a filter when outputting this report to a file for historical purpose.

Posting Permissions

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