Solved

How to close a frozen modal dialog form

Posted on 2009-07-13
8
918 Views
Last Modified: 2013-11-27
I have several apps in Access 2007 that have a number of modal dialog forms.  When I am testing and trying to simulate user conditions and something in the modal dialog form fails, I am always forced to Ctrl-Alt-Delete and force quit the application.

Is there some command or shortcut that will allow me to close such a modal dialog while in an ACCDB so that I can continue my testing?  I can successfully do Ctrl-G and get into the immediate window, but then cannot figure what to do.  It seems like this should be a simple process, but I have never been able to figure out how to handle it.
0
Comment
Question by:wsturdev
[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
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 16

Expert Comment

by:Chuck Wood
ID: 24841983
Type this in the Immediate window and press Enter:
-chuck wood
DoCmd.Close acForm,"FormName"

Open in new window

0
 
LVL 1

Author Comment

by:wsturdev
ID: 24842145
When I do that, I get "Compile Error.  Expected: End of Statement"
0
 
LVL 16

Expert Comment

by:Chuck Wood
ID: 24842170
1. Did you use the name of the form for "FormName"?
2. Did you compile your code and save it before testing?
-chuck wood
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 24842349
You have to use full syntax:

DoCmd.Close( acForm,"FormName")

0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24847554
wsturdev,

1. <something in the modal dialog form fails, I am always forced to Ctrl-Alt-Delete and force quit the application.>
"Something" fails?
Can you be a bit more specific?
I use Modal Dialog boxes in Access 2007 and they close with impunity.

2. Can you post some of your code that generates this mysterious failure, and state what line it fails on?

3. Clearly define what you mean by "modal dialog form".
Modal and Dialog are two separate, but related properties

Thanks

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24847610
Perhaps something is being triggered "Behind" the form.
But since the form is modal/dialog, this "failure" cannot be acted upon.
0
 
LVL 1

Author Comment

by:wsturdev
ID: 24849046
Jeff,
I use "modal dialogs" a lot also, and once I get the code perfected, they work well and consistently.  
I am talking about while I am in the middle of developoment and still perfecting the code (sorry, I am not quite like those Papermate Pens... I don't write [perfect code] the first time, every time.).
I cannot be specific about what fails.  The failures are not "mysterious", and in fact, they do not matter in this case, because I will eventually write correct code.
I was just asking a general question about how to get out of a "modal dialog" that has had some kind of failure in its code that has sent it into Debug Mode, and from which I cannot continue.  I cannot bypass the offending statement and thus cannot get the form displayed completely enough so that I can then click the Cancel button and close it.
The "modal" property of the form is "No".  I open the form in this way:
    Dim stDocName As String
    stDocName = "Dialog_Blah_Blah_Blah"
    DoCmd.OpenForm stDocName, acNormal, , , , acDialog
The code in the calling form pauses processing until the "modal dialog" form is closed and control is returned to the next statement after the calling statement, and while the form is open, no action can be initiated by a user outside the form.  Eventually, the user must do something (e.g. click an Okay button or a Cancel button) to dismiss the "modal dialog" and allow processing on the calling form to continue.
I have always called such forms "Modal Dialogs".  Forgive me if I have used incorrect terminology.
Bill
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24850535

Obviously, this it is hard to troubleshoot with no sample code.

Perhaps another Expert has had this issue and can help you further...

JeffCoachman
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

707 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