Results 1 to 7 of 7
  1. #1
    Forbes's Avatar
    Forbes is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2017
    Posts
    133

    ACCDE ignoring my OnOpen

    So I have all my Forms set as Modal and Popup, I have the Access DB set to hide, all works well. Once I save into an ACCDE the window will not hide when opened from ACCDE anything I am missing here? The DB is Split I noticed this mentioned on another forum but it was never followed up on.

  2. #2
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    you can disable the ribbon and navigation from access and make a "background form" full screen.

    That's what I do anyways. If you're interested ill help you out.

  3. #3
    Forbes's Avatar
    Forbes is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2017
    Posts
    133
    I disabled the ribbon and nav panels but essentially I need it to be gone entirely for security purposes, my last db worked fine when I transferred it over to ACCDE so I feel as though I'm missing something fairly obvious. the code I'm using is this
    Code:
    Option Compare DatabaseOption Explicit
    
    
    Global Const SW_HIDE = 0
    Global Const SW_SHOWNORMAL = 1
    Global Const SW_SHOWMINIMIZED = 2
    Global Const SW_SHOWMAXIMIZED = 3
    
    
    Private Declare Function apiShowWindow Lib "user32" _
    Alias "ShowWindow" (ByVal hWnd As Long, _
    ByVal nCmdShow As Long) As Long
    
    
    Function fSetAccessWindow(nCmdShow As Long)
    
    
        Dim loX As Long
        Dim loForm As Form
        On Error Resume Next
        Set loForm = Screen.ActiveForm
    
    
        If Err <> 0 Then
            loX = apiShowWindow(hWndAccessApp, nCmdShow)
            Err.Clear
        End If
    
    
        If nCmdShow = SW_SHOWMINIMIZED And loForm.Modal = True Then
            MsgBox "Cannot minimize Access with " _
            & (loForm.Caption + " ") _
            & "form on screen"
        ElseIf nCmdShow = SW_HIDE And loForm.PopUp <> True Then
            MsgBox "Cannot hide Access with " _
            & (loForm.Caption + " ") _
            & "form on screen"
        Else
            loX = apiShowWindow(hWndAccessApp, nCmdShow)
        End If
        fSetAccessWindow = (loX <> 0)
    End Function
    and my call on open is
    Code:
    Private Sub Form_Load()
    fSetAccessWindow (0)
    End Sub
    I have tried on load and on open.

  4. #4
    Forbes's Avatar
    Forbes is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2017
    Posts
    133
    **ANSWER** Here is what I had to do:

    I had to set the form event to OnOpen, then change fsetaccesswindow (0) to 1 then save and reopen the db.
    then shift bypass open the db again and change it back to (0) save as ACCDE then when prompted to save the form say yes all will close and tada!!.
    Thanks for the help as always!

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Thanks for your solution. Others could find this valuable.

  6. #6
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    This is really helpful indeed.

  7. #7
    Forbes's Avatar
    Forbes is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2017
    Posts
    133
    ***UPDATE*****

    The above process worked for me, upon updating the database it seemed as though this stopped working, after looking around I finally found a solution, regardless of whether or not you have auto compile activated, you must just before converting go into your debug menu and compile manually then save, this solved the issue once again for me.

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

Similar Threads

  1. OrderBy specified in OnOpen event not taking effect
    By GraeagleBill in forum Reports
    Replies: 4
    Last Post: 03-21-2016, 11:53 AM
  2. Replies: 3
    Last Post: 05-12-2015, 03:43 PM
  3. Replies: 3
    Last Post: 12-22-2014, 11:57 AM
  4. AllowDeletion Property on OnOpen event
    By excellenthelp in forum Access
    Replies: 2
    Last Post: 11-18-2014, 08:31 AM
  5. Replies: 2
    Last Post: 01-22-2013, 10:39 PM

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