Results 1 to 3 of 3

Thread: Access Form Status.

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    22

    Access Form Status.

    May I know how to write a code to check whether this form is already open?

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Access Form Status.

    You may know


    Code:
    on error resume next
    
    strName=forms("formname").name
    Err.Number will be 0 (strname will hold the form name) if the form is open. Otherwise it creates an error.

    This is only one method to do this.
    Last edited by Ecniv; Dec 20th, 2005 at 04:36 AM.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    22

    Re: Access Form Status.

    Got what you mean..

    I want to include this method in my program that everytime when i click on the openform button, it will check whther the form is already open or not.
    if it is open, show a msgbox("already open"), otherwise, just open the form.

    using your method.. i will be able to track when the form is already open.
    but if it is not open.. it keeps popping out error..which i dont know how to deal with it..

    Sub check1()

    Dim strname As String
    On Error GoTo Err_Open
    On Error Resume Next

    strname = Forms("temp").Name
    MsgBox ("open")

    Err_Exit:
    Exit Sub

    Err_Open:
    Resume Err_Exit

    End Sub

    could you enlighten me on that?
    Last edited by spoonjy; Dec 20th, 2005 at 08:52 PM. Reason: illustrating my codes

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