If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Open Report And Pass Filter From The Hyperlink

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-09-12, 11:14
Raddle Raddle is offline
Registered User
 
Join Date: Dec 2010
Posts: 81
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!...
Reply With Quote
  #2 (permalink)  
Old 02-09-12, 12:54
pbaldy pbaldy is offline
Registered User
 
Join Date: May 2005
Location: Nevada, USA
Posts: 2,475
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
Reply With Quote
  #3 (permalink)  
Old 02-10-12, 07:54
Raddle Raddle is offline
Registered User
 
Join Date: Dec 2010
Posts: 81
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 08:40.
Reply With Quote
  #4 (permalink)  
Old 02-10-12, 08:47
Raddle Raddle is offline
Registered User
 
Join Date: Dec 2010
Posts: 81
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 08:59.
Reply With Quote
  #5 (permalink)  
Old 02-10-12, 10:22
pbaldy pbaldy is offline
Registered User
 
Join Date: May 2005
Location: Nevada, USA
Posts: 2,475
Great! Glad it helped you.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On