[AccessD] Closing a form from a module procedure

Barbara Ryan BarbaraRyan at cox.net
Fri Dec 17 19:37:36 CST 2004


Simply put, in an Access 97 application I have Form1 and Module1.  A pushbutton on Form1 executes a procedure in Module1 which closes Form1 (DoCmd.Close acForm, "Form1", acSaveNo) and then deletes Form1 (DoCmd.DeleteObject acForm, "Form1").  However, the Close command does not appear to be working --- I receive an error on the DeleteObject command, saying that Form1 is still open.  Yet when I run the following IsLoaded function after the Close command, it returns false (i.e., Form1 is NOT open).

Any ideas?
Thanks,
Barb Ryan


Public Function IsLoaded(frmName As String) As Boolean
    'checks if a particular form is open

    Dim frm As Integer
    
    IsLoaded = False
    For frm = 0 To Forms.Count - 1
        If Forms(frm).Name = frmName Then
            IsLoaded = True
            Exit For
        End If
    Next frm

End Function



More information about the AccessD mailing list