Results 1 to 4 of 4
  1. #1
    krag is offline Medium experience
    Windows 10 Office 365
    Join Date
    May 2014
    Posts
    71

    Minimize current access window when another access window is opened from current window

    I have a Grand Master Panel to select the required project to open from a list of projects with password entry included.


    When the required project (access) opens, Grand Master Panel (current access) is locked for all key operations.
    When the required project window is closed, current window becomes active to select a project again to open.
    I want the Grand Master Panel window (complete current access app) to minimize when the required access project window has opened.
    When the required project window is closed it would also be helpful to restore the Grand Master Panel window but this is not a must as user can do it manually if required.

    I have tried using the code that I found in one of the other posts, in the Grand Master Panel project itself.


    DoCmd.SelectObject acForm,"GrandMasterPanel" , True
    DoCmd.RunCommand acCmdWindowHide

    It has no effect at all (nothing happens).
    I am not sure if this code has to be written in the other projects in Form Open procedure.
    If so, how do I call the Grand Master Panel dB from another dB?

    Thanks for the help in advance.

  2. #2
    ecampos is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2022
    Posts
    9
    You could hide the form completely. I do this to hide my navigation form when a report is opened in preview mode. And unhide the form when the report is closed:

    Code:
    Public Sub HideNav()
        [Forms]![Navigation].Visible = False
    End Sub
    
    
    Public Sub UnhideNav()
        [Forms]![Navigation].Visible = True
    End Sub

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    suggest clarify your setup - I presume these forms are in different instances of access? but are they popup and/or modal? Are you using overlapping windows or tabbed? Do these other instances have a form specified to open when access opens? or are you using an autoexec macro? or nothering?

    With regards the code provided, 2 lines tells us nothing - is there code before or after these two lines? what event is used to trigger the code? have you turned off warnings? how are you opening (presumably) another instance of access?

  4. #4
    krag is offline Medium experience
    Windows 10 Office 365
    Join Date
    May 2014
    Posts
    71
    Hi Encampos
    Your suggestions are for hiding objects within the current dB and not for hiding the dB itself I presume.

    Hi Ajax
    Your presumption is correct.
    GrandMasterPanel is a lone form in a dB instance (project or whatever you call it).
    User starts working on the entire project by first opening this dB.
    This has a list box to select the project (in altogether different dB or instance as you call it) from a list of 4 different projects.
    Only one project can be selected to open at a time after the password for that project is entered in a text box in the GMP form.
    On click of a control button to open the selected project, that project dB window opens with its own opening form MasterPanel.
    In this condition the controls in the GMP form are disabled.
    When the opened project is closed completely (its .laccdb file closes in directory), the controls in GMP form are enabled to select next project to work on.
    All these functions are working fine.
    Now what I am looking for is to minimize the complete dB window (instance) of GMP form when the selected project dB has been opened.
    It would also help if it can be restored when the project dB is closed but this is not a must as user can restore it manually if required to continue with next project if necessary.
    VBA program for the GMP dB is as below (GetAppPath is in the public functions and gets the file path in directory for the current dB where all the related project dBs are also stored):
    I tried introducing the windowhide code in OpenApp_Click procedure after opening the project module dB, without success.

    As this function is only to make the user more comfortable handling multiple windows by hiding unused windows, it is not a big problem right now without it.
    However, for my own understanding for another new project I am now developing (not related to this one in disussion now), I would like to use the hide function surely.
    So any guidance will be highly appreciated.

    Option Compare Database
    --------------------
    Private Sub AppNameSelector_GotFocus()
    Call CheckLockeddB


    End Sub
    -------------------------------------------
    Private Sub Form_Load()
    Me.AllowEdits = True
    Call GetAppPath
    Me.FilePath = GetAppPath & ""
    Call CheckLockeddB


    End Sub
    ---------------------------------------
    Private Sub ModulePW_GotFocus()
    Call CheckLockeddB


    End Sub
    --------------------------------------
    Private Sub OpenApp_Click()
    Call CheckLockeddB
    If Me.AllowEdits = False Then GoTo 100
    Dim CheckPWRS As Recordset
    Dim db As DAO.Database
    Dim appAccess As Access.Application
    Dim Password, strdBNameOpen, Msg1, Msg2 As String
    Msg1 = "Password is not correct - It is Case-Sensitive."
    Msg2 = "!!INCORRECT PASSWORD!!"
    If Me.ModulePW = "" Or IsNull(Me.ModulePW) Then GoTo 100
    If IsNull(Me.AppNameSelector) Then GoTo 100
    DoCmd.SetWarnings False
    DoCmd.OpenQuery ("DeleteCheckPWQ")
    DoCmd.OpenQuery ("CheckPWQ")
    DoCmd.SetWarnings True
    Set CheckPWRS = CurrentDb.OpenRecordset("CheckPW", dbOpenDynaset)
    If CheckPWRS.RecordCount = 0 Then GoTo 100
    If CheckPWRS![PW] <> Me.ModulePW Then GoTo 100
    strdBNameOpen = Me.FilePath & CheckPWRS![AppName] & ".accdb"
    Password = Me.ModulePW
    Set appAccess = New Access.Application
    On Error GoTo OnErrorHandling
    Set db = appAccess.DBEngine.OpenDatabase(strdBNameOpen, 0, 0, ";PWD=" & Password)
    appAccess.OpenCurrentDatabase (strdBNameOpen)
    Forms![GrandMasterPanel]![ModulePW] = Null
    Forms![GrandMasterPanel]![AppNameSelector] = Null
    100
    Exit Sub


    OnErrorHandling:
    errorno = Err.Number
    If errorno = 3031 Then
    MsgBox Msg1, vbOKOnly, Msg2
    End If


    End Sub
    -------------------------------
    Public Sub CheckLockeddB()
    Dim AppNameListRS As Recordset
    Set AppNameListRS = CurrentDb.OpenRecordset("AppNameList", dbOpenDynaset)
    AppNameListRS.MoveFirst
    Do Until AppNameListRS.EOF
    If Len(Dir(Me.FilePath & AppNameListRS![AppName] & ".laccdb")) = 0 Then
    Me.AllowEdits = True
    AppNameListRS.MoveNext
    Else
    Me.AllowEdits = False
    Exit Do
    End If
    Loop


    End Sub
    -----------------------------------

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

Similar Threads

  1. Minimize the Access Window
    By GraeagleBill in forum Access
    Replies: 46
    Last Post: 05-07-2021, 08:47 AM
  2. Replies: 10
    Last Post: 12-05-2017, 01:14 AM
  3. Replies: 5
    Last Post: 10-29-2017, 06:46 AM
  4. Minimize form If access Window is restored
    By Lukael in forum Programming
    Replies: 2
    Last Post: 04-02-2016, 10:25 AM
  5. Minimize access window problem
    By McHammer in forum Forms
    Replies: 2
    Last Post: 04-24-2010, 05:14 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