Results 1 to 2 of 2

Thread: Run time error 401

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2001
    Location
    Scotland, UK
    Posts
    321

    Question

    Does anyone know what this error, means and how I can fix it.

    It only happens, in the compiled version of the program (The one that runs independantly of VB), It doesn't occur in the version that needs VB.

    It also only started happening in the new version of the program, and I don't know what it means!

    Heres the error;

    "Run time error 401"
    "Cant show non-modal form when modal form is displayed"

  2. #2
    Fanatic Member
    Join Date
    Jan 2001
    Location
    Vietnam
    Posts
    613
    AliBail,

    When a modal form is displayed, you can’t display another non-modal form.

    For example, I have 3 forms

    Code:
    'this is the code for form1
    Private Sub Command1_Click()
        'show form2 as Modal
        Form2.Show vbModal, Me
    End Sub
    
    'this is the code for form2
    Private Sub Command1_Click()
        'show form3 as NON MODAL, this will raise error
        Form3.Show
    End Sub

    How to fix it:

    Use either the Unload statement or the Hide method on the modal form before attempting to use the Show method on a non-modal form.


    Regards,
    TheBao

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width