Results 1 to 9 of 9
  1. #1
    Ossos is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Oct 2016
    Posts
    14

    Check that My Form is not Closed

    Please, what is wrong with this if statement

    If [0_Haram's Healthcare Dashboard N].IsLoaded = False Then
    MsgBox "No Previous Screen The Screen 11 is Closed"



    Else
    Forms![0_Haram's Healthcare Dashboard N].Visible = False

    End If

    i am keep receiving Run-Time error 2465
    MS Access can't find the field '|1' referred to in your expression.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Maybe
    Forms![0_Haram's Healthcare Dashboard N].IsLoaded

  3. #3
    Ossos is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Oct 2016
    Posts
    14
    i changed it to

    If [0_Haram's Healthcare Dashboard N].IsLoaded Then
    Forms![0_Haram's Healthcare Dashboard N].Visible = False

    Else

    MsgBox "No Previous Screen The Screen 11 is Closed"
    End If

    still relieve the same error

  4. #4
    Ossos is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Oct 2016
    Posts
    14
    I even used "IF Not"

    If Not [0_Haram's Healthcare Dashboard N].IsLoaded Then
    Forms![0_Haram's Healthcare Dashboard N].Visible = False

    Else

    MsgBox "No Previous Screen The Screen 11 is Closed"
    End If


    I got the same Error

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Let me look at my notes and see how I have done it in the past.

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Here, I tested this.
    Code:
    Dim bolAnswer As Boolean
    Dim strFormName As String
    'strFormName = Me.Name
    strFormName = "OtherFormName"
    bolAnswer = (SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> 0)
        If bolAnswer = True Then
            MsgBox strFormName & " is open"
        Else
            MsgBox strFormName & " is closed"
        End If

  7. #7
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349
    For the record:
    Code:
    If CurrentProject.AllForms("0_Haram's Healthcare Dashboard N").IsLoaded = False Then
        MsgBox "No Previous Screen The Screen 11 is Closed"
    Else
        Forms![0_Haram's Healthcare Dashboard N].Visible = False
    End If

  8. #8
    Ossos is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Oct 2016
    Posts
    14
    It works ... :-)

    Thank you All, Please jwhite would you please explain to me the logic behind it?

    Regards

  9. #9
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Yeah jwhite, what does your code do, exactly?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 03-28-2013, 07:54 AM
  2. Form not getting closed at first time
    By vikasbhandari2 in forum Programming
    Replies: 10
    Last Post: 07-20-2012, 01:25 PM
  3. Replies: 1
    Last Post: 03-30-2012, 11:57 PM
  4. Replies: 4
    Last Post: 08-17-2011, 05:30 AM
  5. check if all objects are closed (forms & reports)
    By RedGoneWILD in forum Access
    Replies: 2
    Last Post: 09-03-2010, 05:53 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums