Results 1 to 4 of 4
  1. #1
    Kivan is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    27

    How to check if any form is loaded

    Hey,



    I have a keyboard shortcut to open Menu. But I want this shortcut to be active only when there is no form loaded. Is there any VBA code to check If any form is loaded? And also, does autokeys must be a macro, or can it works as VBA code?

    Reagrds.

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Is there any VBA code to check If any form is loaded?
    The function below should return "True" if any form is open.
    Code:
    '---------------------------------------------------------------------------------------
    ' Procedure : fnFormIsOpen
    ' Author    : Bob Fitz
    ' Date      : 03/09/2012
    ' Purpose   :
    '---------------------------------------------------------------------------------------
    '
    Public Function fnFormIsOpen() As Boolean
    On Error GoTo Err_fnFormIsOpen_Error
      Dim frm As AccessObject
      For Each frm In CurrentProject.AllForms
        If frm.IsLoaded Then
          fnFormIsOpen = True
        End If
      Next
    Exit_ErrorHandler:
      Exit Function
    Err_fnFormIsOpen_Error:
      MsgBox "Error " & Err.Number & " " & Err.Description
      Resume Exit_ErrorHandler
    End Function
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Kivan is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    27
    Thank you Bob, it works well .

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    You're welcome. Glad we could help.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. Replies: 11
    Last Post: 12-28-2011, 04:27 AM
  2. Subform empty when main form loaded
    By martyjward in forum Forms
    Replies: 1
    Last Post: 08-15-2011, 04:37 AM
  3. Replies: 1
    Last Post: 05-18-2011, 12:23 PM
  4. Replies: 0
    Last Post: 07-05-2010, 08:00 AM
  5. To check or Un-Check all Boxes in a form
    By devcon in forum Forms
    Replies: 7
    Last Post: 05-01-2010, 12:03 AM

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