Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2010
    Posts
    134
    Provided Answers: 1

    Unanswered: Open Report And Pass Filter From The Hyperlink

    HI

    I need to open a report and pass the filter criteria to it as it opens. So I have a list of possible reports, and if I client say Dept 1, I want that to be the criteria that the query recevies and uses to run the report.

    So:
    Private Sub Domain_Click()
    DoCmd.OpenReport "rpt_List Servers In Single Domain", acViewPreview, , , acWindowNormal, strDomain
    End Sub

    The issue is the last bit. How do I tell Access that the link I just clicked IS the report criteria I want it to use?

    Please help.. I am going bald(er) here!...

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    What does the variable contain exactly? Would it be appropriate to put it in the wherecondition argument?

    Open a second form to the record

    You have it in the OpenArgs position; to use it there you'd also put code in the report's open event to use it as appropriate.
    Paul

  3. #3
    Join Date
    Dec 2010
    Posts
    134
    Provided Answers: 1
    Hi - thanks for much for coming back to me. I remember you were kind enough to answer a query of mine before!

    So I have created a dashboard, which contains various subforms, each of which has a list of say, Departments. I want to click on one of the listed items and for the underlying report to open up, filtered by the Department I just clicked.

    This is what i have now, but the Report is trying to use the word DOMAIN as the filter.

    Private Sub Domain_Click()
    DoCmd.OpenReport "rpt_Final Aggregate", acViewPreview, , "[Domain] = 'Domain'"
    End Sub

    What I need is to pass Dept. A as the filter criteria.

    Thoughts, very very welcome and thank you in advance.

    Last edited by Raddle; 02-10-12 at 09:40.

  4. #4
    Join Date
    Dec 2010
    Posts
    134
    Provided Answers: 1
    Thank you so so so much for sending the link to BaldyWeb. It contained precisely, I mean 100% exactly what I was looking for.

    Private Sub Domain_Click()

    DoCmd.OpenReport "rpt_Final Aggregate", acViewPreview, , "[Domain] = '" & Me.Domain & "'"
    End Sub


    This code now works.

    thank you so much again.

    PS - I am also bald.
    Last edited by Raddle; 02-10-12 at 09:59.

  5. #5
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Great! Glad it helped you.

Posting Permissions

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