Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Jan 2004
    Location
    Long Island, New York, USA
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Running reports from differnt places (Access 2000)

    I have a lot of reports in my system who have queries with criteria linking them to specific forms. Now I am finding I need to run these same reports from other locations within the database. Obviously I could recreate all the reports/ queries with the criteria pointing at the new location, but this is extremely cumbersome. So, What other options do I have?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Running reports from differnt places (Access 2000)

    If you open a report (or form) in code, for example from a command button on a form, you can pass a where-condition. For example:

    DoCmd.OpenReport ReportName:="rptMyReport", View:=acViewPreview, WhereCondition:="EmployeeID = " & Me.txtEmployeeID

    So you could remove the criteria from the queries that serve as record source for the reports, and use code like the above to specify the criteria.

  3. #3
    New Lounger
    Join Date
    Jan 2004
    Location
    Long Island, New York, USA
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Running reports from differnt places (Access 2000)

    This is a great idea. However, I use the Access snp viewer to preview reports. I use the Docmd.OutputTo method to create the snp file. This does not seem to take any Where conditions for the report I am running. If I were to remove the conditions from the query, how would I apply them to the report when a user wants to preview it only?

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Running reports from differnt places (Access 2000)

    Another way to do this would be to create a form that would stay hidden. This would have all the fields that could be used by the queries. Any form that accepts criteria for a report would simply populate the relevant fields on the hidden form that all queries reference.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Running reports from differnt places (Access 2000)

    You didn't mention that you wanted to export the report to snapshot in your original question. Code like this works for me in Access 2002 SP-2, I don't have Access 2000:

    DoCmd.OpenReport "rptBooks", acViewPreview, , "BookID=" & Me.BookID
    DoCmd.OutputTo acOutputReport, , acFormatSNP, "Books.snp", True

Posting Permissions

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