MSAccess Lose Focus on Print Preview (1 Viewer)

PirateEyes

New member
Joined
Jan 9, 2013
Messages
1
This is an old thread but having had the same issue I thought I'd respond.

One accees database I'm currently modifying had a similar issue. The report would be opened in Report View (which is different from Print Preview) so that the report could be interacted with (Drill down reports by double-clicking in areas).

If the user tried to Print Preview (for some reason the users preferred Print Preview over just printing the report) by using a button off the report, Access would lose focus.

This was solved by simply closing out the report, before opening it print preview mode. May not work for this specific use, but thought I'd share in case new users stumbled upon this thread.:)

Button from the Report View was as follows:

DoCmd.Close acReport, "Report Name"
DoCmd.OpenReport "Report Name", acViewPreview
 

Sandy44

New member
Joined
Jun 23, 2013
Messages
1
You know something else I have never tried to do which might be creting the problem. Technically the report is already open to print and you have a button that switches the same report to print preview. Why? Why not just put a print button there?
Have you found any solutions for this issue? I use Access 2010 on Windows 7, and I've run into the same problem. I like to do a print preview, because the report view doesn't show me the footer with page numbers. (Sometimes I like to only print a few of the pages, not the entire report.) When I switch to the print preview from the menu, it works fine. However I've created a button on the report that displays only on the screen. That button runs a macro (RunMenuCommand, Print Priview) to print preview the report. But as soon as I hit the button, the report loses focus. Nothing is clickable. When I <Alt Tab> to something else and back, I have focus again.

A work-around I found was to close the report (Close Window, Report), then re-open the same report (OpenReport, PrintPreview) in print preview mode. I'm wondering if the problem is because the RunMenuCommand macro doesn't take an argument. :confused: I would still like to figure out why it doesn't work correctly.
 

GinaWhipp

AWF VIP
Joined
Jun 21, 2011
Messages
5,596
Sandy44,

No have not found a solution to this issue, nor have I found out why it happens.
 

haimster2797

New member
Joined
Jun 15, 2017
Messages
4
I had this same issue and the way to fix this is open the "Event" Macro you created for your "Print Preview" custom button, and underneath the last statement after opening up Print Preview in Normal Window, add the following Macro Action below it:

CANCEL EVENT

Then this issue will be resolved and it will no longer lose focus. Issue is that your macro doesn't have an IF Statement in it, so it is waiting to timeout waiting for next command. By adding "Cancel Event" to the the end, it exits the macro script.

Let me know how it goes.
 

isladogs

CID Moderator
Staff member
Joined
Jan 14, 2017
Messages
12,353
Haimster

Do you realise you answered a post that was over 4 years old....?
 

haimster2797

New member
Joined
Jun 15, 2017
Messages
4
Yes, but case in point, I was searching for such an issue once this week, and when you GOOGLE the problem, my search revealed this forum article, and so I consider it frustrating if my exact issue is posted even from 4 years ago and there is no answer to it and I (a different user) still need the answer. As in the American President, Michael J Fox says, now there's this thing hanging out there... No one ever answered.

So in the event some poor soul 1 year from now is trying to figure this out like I was and GOOGLED it, he now has the solution.

AND just maybe that same guy is STILL searching the world for his solution never replied on, Lost wandering... I have brought closure!:cool:

:) Lol
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom