AllExperts > Business Software 
Search      
Business Software
Volunteer
Answers to thousands of questions
 Home · More Business Software Questions · Answer Library  · Encyclopedia ·
More Business Software Answers
Question Library

Ask a question about Business Software
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Scottgem
Expertise
I can answer some questions on a wide variety of business applications, including MS Office, Lotus Smartsuite, Visio, Notes and many others.

Experience
I have over 16 years of experience as an IT professional, supporting a wide variety of business applications.

 
   

You are here:  Experts > Computing/Technology > Business Software > Business Software > Printing a filtered datasheet

Business Software - Printing a filtered datasheet


Expert: Scottgem - 3/11/2009

Question
In an Access 2007 database, is there a simple way in VBA to determine a (subform) datasheet's data (as filtered and ordered by the end user) in order to print just their selection via a print button on the main form?

Answer
If there is a filter being applied to a subform, you can use the Filter property in the OpenReport method like so:

DoCmd.OpenReport "reportname",,,Me.Filter

However, this may not pick up the filtering that is performed by the parent-child link between the main form and subform so you may need to use:

DoCmd.OpenReport "reportname",,,Me.Filter & " AND [foreignkey] = " & Forms!mainformname!keycontrolname

Hope this helps,
Scott<>
Microsoft Access MVP 2007
Author: Microsoft Office Access 2007 VBA

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.