[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Close Report with Esc Key

Posted on 2011-03-08
11
Medium Priority
?
1,450 Views
Last Modified: 2012-05-11
Hi

Want to close a report by using Esc key. In 2003 this functionality works fine, but not in 2007.

In 2007 can get it to partially work by making report modal. I double click a form control and the report opens. Then press Esc and report closes. But if I use the magnifier to enlarge the report, then click the magnifier again to reduce it back to the original size, the Ecs key does not fire. I first have to click  in the blue margin next to the report then Esc works. I know it is only one extra click but I'd really like it to work like it does in 2003.

Then thought I'd do an On key Down event but get error 2585, "action cant be carried out while processing a form or report".

Any ideas how to get this functionality working.
Thank you

Private Sub Report_KeyDown(KeyCode As Integer, Shift As Integer)
'trying to close the report with Esc 
If KeyCode = 27 Then 
DoCmd.Close acReport, Me.Name, AcSaveNo 
End If 
End Sub

Open in new window

0
Comment
Question by:ohgee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
11 Comments
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 300 total points
ID: 35069876
You can do this, but most developers would advise against it.

In Access 2007 the DB Objects can be opened as "Tabbed Documents" or "Overlapping Windows"
The "Tabbed Documents" is a new interface option and does not function the same as the old "Overlapping Windows" interface.
So closing an object is not the same for all setups.
Hence your issues with trying to do this...

BTW are you trying to close the report from Report View or Print Preview?
If so, then there is probably no need for the Save Argument.

JeffCoachman
0
 

Author Comment

by:ohgee
ID: 35076707
Thanks, but do not understand. Can I do this or is it not possible in 2007.
Dont think I am opening the report in tabbed or overlapping mode, will check into this.
Does the magnifier have an event, if yes maybe I can code something behind this.
0
 

Author Comment

by:ohgee
ID: 35076789
Ok, I  openi it in print preview and I see the tab; presume this is the tabbled view.
How do I open it in overlapping mode, is this the "report view". Will experiment, see what happens.
Thanks
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:ohgee
ID: 35076974
Seems in tabbed and report view mode, have to click in the blue margin outside the body of the report to get the esc to work.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35105417
OK, so where do we stand on this Question now?
0
 

Author Comment

by:ohgee
ID: 35127515
Suppose if it cant be done then I'll have to figure another solution. Thanks for trying to help
0
 

Author Closing Comment

by:ohgee
ID: 35127542
Not sure if it helped me. Have tried other forums too, no luck so I suppose that the solution confirms it cant be done
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35129552
Again, you can do it, ...but it creates a non-standard , counter-intuitive interface.
Especially in the new Office 2007/2010 world where the windows may be open in Tabbed documents mode, or the report is opened in Report View.

In other words, the Interface though which many Microsoft Apps run is evolving, ...support for many things you used to do are being phased out.

You really don't want to design old, outdated, non-standard , counter-intuitive interfaces that may, ...at best cause "issues" in many situations, ...or worse not work at all in newer Office or Windows versions.

In any event you should put your code the KeyPRESS event and open the report explicitly in Print Preview.


JeffCoachman
0
 

Author Comment

by:ohgee
ID: 35131402
Thanks Jeff, I'll try it.
It is just much easier hitting esc than it is trying to hit the close button with the mouse. Users have loved closing with esc
0
 

Author Comment

by:ohgee
ID: 35132403
And I see now that not only does Esc not work slickly, you also cannot scroll the report with page up and page down unless you first click in the blue margin. Not nice....
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35132522
That was my point...
;-)

Jeff
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question