Need help on how to run Access Query with Where Clause

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RamJha
    New Member
    • May 2012
    • 1

    Need help on how to run Access Query with Where Clause

    DoCmd.OutputTo acOutputQuery, "Production Volume Report_MM", ac_FormatXLS, "C:\Product ion volume Report.xls"

    In the above code "Production Volume Report_MM" is Query already existing in MS Access. Now i want to put the Where clause in the above syntax.
    like.
    DoCmd.OutputTo acOutputQuery, "Production Volume Report_MM where Period='2011'", ac_FormatXLS, "C:\Product ion volume Report.xls"

    But this code is not working.

    Please help me..
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    The outputto function does not allow for an optional where/filter clause. You will need to use a parameter in the query or change the query before you use the outputto.

    Comment

    Working...