How do you force an open report to the last page with VBA?

G

Guest

I posted earlier today asking how to prevent code from executing until a form
was fully opened. That's been solved.

However, the next step is programmatically forcing the report to the last
page. I tried the following code:

Reports(strReport).Page = Reports(strReport).Pages

Interestingly enough, the Page value *is* changed to that of the last page,
but the report itself remains on page 1 as if no code was ever executed!

I searched through the DoCmd (and similar) actions, thinking I could use the
page tool at the bottom of the report to send either the page value or the
required number of clicks, but I can't find anything that looks promising.

Any ideas?

Thanks,

Randall Arnold
 
G

Guest

Never mind-- answered this one myself. The following code does the trick:

SendKeys "{End}"
DoEvents

The DoEvents is important-- it makes sure SendKeys is processed; otherwise
code execution continues and the SendKeys doesn't fire until well past where
I want it.

Randall Arnold
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top