Solved

MDI forms can't be Modal

Posted on 2004-09-02
2
136 Views
Last Modified: 2010-05-02
In the following code "frmMain" is a MDI form. Since MDI forms can't be Modal, the execution of the code will continue to "GlobalErrorHandlerDestroy" and deactivate
my error handler as quickly as it has been activated. Is there any workaround? In other words, I only want "GlobalErrorHandlerDestroy" to be exexuted when the
program is being terminated (fMain being closed).

Public Sub Main()
Const csSUBNAME As String = "main"
On Error GoTo ErrorHandler

    GlobalErrorHandlerCreate
   
    Set fMain = New frmMain
       
    fMain.Show  '(VBModal can be used here)
 
    GlobalErrorHandlerDestroy
   
Exit Sub
ErrorHandler:
    If go_Err Is Nothing Then
        MsgBox "Could not initialise error handler.", vbCritical
    Else
        If go_Err.ErrReport(Err, Erl, csMODULENAME, csSUBNAME) Then Resume
    End If
End Sub
0
Comment
Question by:inorse
2 Comments
 
LVL 22

Expert Comment

by:DarkoLord
ID: 11967594
One way would be to create another function and call it from frmMain when it is being closed....

Darko
0
 
LVL 32

Accepted Solution

by:
Erick37 earned 250 total points
ID: 11968173
Why not set frmMain as your startup form.  Then create your error handler in MDIForm_Load and destroy it in MDIForm_Unload?
0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

770 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