Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Filter OutputTo PDF
Sami Shamma 
             
3 years ago
Good morning friends
I have a button that execute the following:
   DoCmd.OpenReport "ChapR", acViewPreview, , "ChapID= " & ChapID
it works great.

I would like to have another button that execute the following:
   DoCmd.OutputTo acOutputReport, "ChapR", acFormatPDF, OutputFile

but somehow pass it the WHERE in the first button ["ChapIID = & ChapID]

Is there a trick I can filter the report "CharR" before outputing it to PDF?

Thanks
Kevin Robertson  @Reply  
          
3 years ago
I would build a Query to filter the records then base your report off of that.

Open Report
Export Reports to PDF
Sami Shamma OP  @Reply  
             
3 years ago
Thank you Kevin
That should work
Juan C Rivera  @Reply  
            
3 years ago
You can set up a query or do some SQL from with in the button
Query Criteria
The kink will give you an idea and maybe help you with what approch you will like ti take.  After watching this video if you still need help come on back and lets see if we can walk it through.  

V/r
Juan
Juan C Rivera  @Reply  
            
3 years ago
WOW Kevin thanks I did not see this video I am going to watch it today....
Kevin Yip  @Reply  
     
3 years ago
Use a blank report name for OutputTo and it will output the active report, the one you just opened with the filter.  No need to change the report's record source.  OutputTo will use whatever filter you used with OpenReport:

DoCmd.OpenReport "ChapR", acViewPreview, , "ChapID= " & ChapID
DoCmd.OutputTo acOutputReport, "", acFormatPDF, OutputFile
Sami Shamma OP  @Reply  
             
3 years ago
Kevin

What would I do without you?!

Thank you so much.

Is there a way to issue the first command:

DoCmd.OpenReport "ChapR", acXXXXXXXX, , "ChapID= " & ChapID
Where XXXX does nothing?
Sami Shamma OP  @Reply  
             
3 years ago
i figured it out.
i just did this

    DoCmd.Echo False
    DoCmd.OpenReport "ChapR", acViewPreview, , "ChapID= " & ChapID
    DoCmd.OutputTo acOutputReport, "", acFormatPDF, OutputFile
    DoCmd.Close acReport, "ChapR", acSaveYes
    DoEvents
    DoCmd.Echo True

worked like a charm

Thanks again Kevin

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/2/2026 4:26:48 AM. PLT: 0s