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 
Open Report at Last Page
Sandra Truax 
         
4 years ago
Can someone tell me how to open my reports to the last page?  I've tried using DoCmd.RunCommand acCmdRecordsGoToLast, but it crashed the report.  I've been trying to find out on Google, gut it keeps wanting me to use SendKeys which keeps turning my NumLock off.
Adam Schwanz  @Reply  
           
4 years ago
Sendkeys is the only way that I know of

    DoCmd.OpenReport "CustomerR", acViewPreview
    SendKeys "{END}", True
Sandra Truax OP  @Reply  
         
4 years ago
Thanks, Adam.
Adam Schwanz  @Reply  
           
4 years ago
Yea, sorry not good news, everything I've ever seen about it is with send keys. There are ways to print just the last page, but it doesn't work in print preview, just direct to printer.
Kevin Robertson  @Reply  
          
4 years ago
I found a few different solutions, tested them and guess what, NONE of them worked.
If you need the Num Lock to remain in its current state check out the Caps Lock On Off Extended Cut.
Alex Hedley  @Reply  
           
4 years ago
Why do you need to?
Sandra Truax OP  @Reply  
         
4 years ago
Alex, the report I open is 32 pages long in order to get the running balance to be right, and I'm lazy and didn't want to click on the arrow at the bottom of the page, LOL.

Kevin, thank you for trying to find a solution. I'm like you, I tried lots of things, but nothing worked. I'm sure I have spent more time trying to find a solution, than I will ever use in clicking the "go to last page" button at on the report. :)    Just trying to learn something new.
Alex Hedley  @Reply  
           
4 years ago
Could you not just create a summary report with just the info you need?
Sandra Truax OP  @Reply  
         
4 years ago
Alex, if it can be done, I haven't been able to figure out how.  I tried just pulling the data for the current year, but the running sum is than wrong because it starts with Jan 1, instead of the first of the data which is 2017.  I was doing a new entry for each year of Balance Brought Forward, but then was running into other issues.  I don't look at the report very often, so I'll just go ahead and click the "go to last page" button.
Kevin Yip  @Reply  
     
4 years ago
A web browser can open a PDF file at a specific page so you can use that to your advantage.  For instance, this URL opens the PDF at page 6:

     file:///C:/My Documents/MyPDF.pdf#page=6

It has to be an existing page number, so you need to find the page count of your report.  Create a report footer.  In the footer's Print event, assign the page count to a global variable.  Since the report footer is the last thing to be printed, the page count at that point must be right.  The VBA code is:

     GlobalVar = Me.Pages

Run the report, output it to a PDF with DoCmd.OutputTo.  Set the final option to "False" (which is the default anyway) so the PDF does not open, because you want it to be opened later by the web browser:

     DoCmd.OutputTo acOutputReport, "MyReportName", acFormatPDF, "C:\My Documents\MyReportName.pdf", False

Finally, you use VBA to open the web browser and the PDF at the page number which you stored earlier in GlobalVar:

     Shell "C:\Program Files\Mozilla Firefox\firefox.exe ""file:///C:/My Documents/MyReportName.pdf#page=" & Gpagecount & """"

Screenshot of the result below.
Kevin Yip  @Reply  
     
4 years ago

Sandra Truax OP  @Reply  
         
4 years ago
@Kevin, I'm not uploading to a web browser, just want it to open as Print Preview and go to the last page.  How would I modify your code for this?
Kevin Yip  @Reply  
     
4 years ago
Hi Sandra, you won't be uploading anything.  A web browser doesn't just open stuff on the Internet; it can also open files such as PDFs stored in your PC.  Instead of opening it in print preview, you open it in the browser.  And it's instantaneous, with the last page shown to you.  So I would think this should serve your purpose just as well.
Sandra Truax OP  @Reply  
         
4 years ago
Keven, I didn't realize you could do that.  I will definitely be giving this a try!  Thanks!

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/8/2026 8:10:35 PM. PLT: 1s