Results 1 to 4 of 4

Thread: What is the best code for Exit?

  1. #1

    Thread Starter
    Lively Member flint's Avatar
    Join Date
    Oct 2000
    Posts
    67

    Question

    For my mnuExit_Click event I am currently using:

    unload frm1
    unload frm2
    etc...

    I know there's a better way. Could someone pls share?
    Thank you

    Flint

  2. #2
    Guest
    End - It atleast unloads all the forms and quits the program.


    You could also have everything in your Form_Unload. Call it like Call Form_Unload at any item you want to have the quit.

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    I generally use a global sub so no matter where the exit is called it uses the same code:
    Code:
    Public Sub CloseAll()
        'Closes all open recordsets using de as a data environment
        For X = 1 To de.Recordsets.Count
            If de.Recordsets.Item(X).State <> asStateClosed Then
                de.Recordsets.Item(X).Close
            End If
        Next X
    
        'Closes all open forms
        For Each Form In Forms
            Unload Form
        Next
        'Makes sure the program ends
        End
    End Sub
    Using just 'End' can cause memory lag

    [Edited by Edneeis on 11-27-2000 at 02:55 AM]

  4. #4

    Thread Starter
    Lively Member flint's Avatar
    Join Date
    Oct 2000
    Posts
    67

    That's it!

    Thanx...That's What I was looking for. Thank you for your thought and precious time.

    Flint

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