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 
Print report based case select
Juan C Rivera 
            
5 years ago
All Good Day,
I know I saw this in one of the developer videos just can't recall. I build a table and re-query with SQL, the form works as advertised. Using the select case I resort the form then send to print
I added a report after the fact. I should have done it when it was fresh in my mind.
DoCmd.OpenReport "Report2schduleTrng", acViewReport, "", "", acNormal

How do I set the record source after the select case so the report will print?
Yes I am having a senior moment.

Thanks
V/r
Juan
Adam Schwanz  @Reply  
            
5 years ago
Sorry i dont follow, What is select case? Are you selecting a record or changing the text capitalization?
Juan C Rivera OP  @Reply  
            
5 years ago

Juan C Rivera OP  @Reply  
            
5 years ago
Hello Adam. Let me see if I can get out of my Spanglish mode.
I am trying to print a report based on select case.  I have the report set up but will like to send the recordsource to the report to print in the selected manner.

V/r
Juan
Adam Schwanz  @Reply  
            
5 years ago
Sorry Juan, I still don't understand the select case part. You're just making a record source with a SQL statement and then want to send that to the report though?
Juan C Rivera OP  @Reply  
            
5 years ago
yes
Adam Schwanz  @Reply  
            
5 years ago
So I just tested passing to a report. This is passing a SQL statement setting a rowsource for a listbox. I'm pretty sure you can use Forms!FormName.recordsource instead. This works for me in the on load event of the report to set it's record source.

Private Sub Report_Load()
Me.RecordSource = Forms!PartSearchF!PartList.RowSource
End Sub
Adam Schwanz  @Reply  
            
5 years ago
If you're not using that SQL statement to make the record source of the form. You can also do the old hidden text box and set it to hold your sql statement then pass that over too.
Juan C Rivera OP  @Reply  
            
5 years ago
It works Awsome.... Thanks Adam.
Scott Axton  @Reply  
        
5 years ago
Adam -
Select Case is an Access Function.  Richard has not covered it in great detail though if you search it there are some links.

Here is another link with a description and examples of use that you might find helpful:

https://www.techonthenet.com/access/functions/advanced/case.php

Juan C Rivera OP  @Reply  
            
5 years ago
OH that's jacked, I was trying to see who else liked it.....I got pooped.
Adam Schwanz  @Reply  
            
5 years ago
same thing happened to me a few days ago LOL
Alex Hedley  @Reply  
           
5 years ago
I guess Rich still needs to do the TH mentioned on your previous post
Richard Rost  @Reply  
          
5 years ago
Hi guys. Sorry I took the day off yesterday and missed this whole conversation. I've covered Select Case in a few Developer classes (like 2 and 13) but I haven't covered it in DETAIL yet. I'll add it to my list. I try to keep the TechHelp videos short, so I could cover the basics in it, but the meat and potatoes will take me a lot longer - Ext Cut at least, but since I haven't done this in a Dev class yet, that's where I'll start it. It is handy, but it's really just a way of shortening an If/Then/Else block. Both can do the exact same thing. And yes, I like Adam's hidden text box to pass the SQL string. That or you could use TempVars, another concept I have to cover fully. I do cover opening a report with custom SQL in the SQL Seminar Part 2, but I could probably do a little bit about this in the next Dev class too. So much I have to cover still. I'm queuing up D28 now.
Richard Rost  @Reply  
          
5 years ago
Haha... Juan's comment that he got pooped... I've always found it hilarious when people on sites like Facebook LIKE their own posts. So go ahead and see what happens if you try to LIKE your own comments here. :)
John Davy  @Reply  
         
5 years ago
Hi Juan, Maybe you could add a button on your report and try

Private Sub cmdPrintTypeReport_Click()
   DoCmd.SelectObject acReport, Screen.ActiveReport.Name
   DoCmd.RunCommand acCmdPrint
End Sub

HTH  John
Juan C Rivera OP  @Reply  
            
5 years ago
You are so funny I got a kick out of it.

V/r
Juan
Juan C Rivera OP  @Reply  
            
5 years ago
John Thanks But Adam pointed me in the right direction.

V/r
Juan

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/6/2026 11:41:13 PM. PLT: 1s