UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Applying A Filter Then Printing    
 
   
Wood Butcher
post May 23 2011, 01:20 PM
Post #1

UtterAccess Member
Posts: 33



I have the same report that runs for different users. So what I'm trying to do is put a button out there that will basically run thru and change the report header and data returned for each user.

The report header part works fine, but the applied filter part isn't working at all...I"m getting all the data!

DoCmd.OpenReport "Location", acViewDesign, , "[User1] = True"
DoCmd.SetProperty "label166", acPropertyCaption, "User1's Daily Report"
DoCmd.PrintOut

DoCmd.OpenReport "Location", acViewDesign, , "[User2] = True"
DoCmd.SetProperty "label166", acPropertyCaption, "User2's Daily Report"
DoCmd.PrintOut

Etc, etc....

I have a field for each user in the query and on the report (hidden on the report) as a yes/no field. So if [User1] is checked they only get the records that they are checked off on.

HELP!
Go to the top of the page
 
+
theDBguy
post May 23 2011, 01:45 PM
Post #2

Access Wiki and Forums Moderator
Posts: 48,613
From: SoCal, USA



Hi,

What version of Access are you using? Sounds like you may have a "repeating group" in your table which is usually a sign of bad design. We might be able to suggest another way to accomplish what you want if you could describe your table structure for us.

Just my 2 cents...
Go to the top of the page
 
+
John Spencer
post May 24 2011, 09:14 AM
Post #3

UtterAccess VIP
Posts: 2,473
From: Columbia, Maryland



Instead of opening the report in design view, open the report to preview or print. The criteria string you set in design view is temporary and will not get used when you switch to preview or print. Use the OpenArgs argument to pass the label change

DoCmd.OpenReport "Location", acViewPreview, , "[User1] = True",,"USER 1 Report"

Then in the open event of the form use code to set the caption of the label to the value of the report's open args property
Me.Label166.Caption = Me.OpenArgs & ""


Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th June 2013 - 11:06 AM