Results 1 to 5 of 5
  1. #1
    fnem is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2015
    Posts
    19

    Access background interface reappears when Access icon clicked on taskbar

    I have an issue with my database. I want to run it in a window as an ap without all of the Access interface. I've been successful in this by setting the forms to popup and modal and using the code below on the startup form. I got the code off another forum and it works really well, that is until you click the Access icon on the Windows taskbar at which point the Access interface becomes unhidden. I have tried attaching the code to other events on the form such as On Activate and On Load etc but can't find a way of stopping the Access interface from reappearing. It is inevitable that users will at some point click the taskbar icon, I did it during testing when I opened another window and then went back to my database. I'd welcome any suggestions on how to overcome this problem.

    This is the code I call on the On Open event of my startup form:

    Option Explicit

    'This function switches the display mode of the Access design database, call function and pass in appropriate constant, code off forum

    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

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    what about the macro:
    DoCmd.SelectObject acTable, , True
    DoCmd.RunCommand acCmdWindowHide

  3. #3
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    I do the same to keep my users out of the Access interface and the ribbon. Try using this code in the On Open event of your startup form:

    Code:
      DoCmd.RunCommand acCmdWindowHide
      DoCmd.ShowToolbar "ribbon", acToolbarNo
      DoCmd.Restore
    I can minimize and restore by clicking the toolbar icon with no problem, and the minimize button on the Access application window also works.

    You can stop users from pressing F11 to get to the Access interface by turning special keys off:

    File - Options - Current database, then clear the checkbox for "Use Access Special Keys"

  4. #4
    fnem is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2015
    Posts
    19
    Ranman and John, thanks for your suggestions.

    I've tried the code you refer to, I found I needed the following line to get the code to run

    DoCmd.NavigateTo "acNavigationCategoryObjectType"

    The good thing about the original code I posted above is that it completely hides the Access window, whereas the code you posted appears to depopulate it but still there is the rather unsightly, albeit empty Access window in the background behind my form

    One other thing I find with your code is that I can still right click on the top of my form and go in to design mode, how do you overcome that?

    If I can't find a way of making my original code keep the window hidden even when the taskbar icon is selected then I may use both sets of code in tandem so that at least if it does happen the Access interface will be blank and no harm can be done. It does feel rather like an unhappy compromise though.

  5. #5
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Code:
    One other thing I find with your code is that I can still right click on the top of my form and go in to design mode, how do you overcome that?
    Set the Shortcut Menu property of the form to No.

    Unfortunately, I can't help with hiding the Access window while showing your application window - I've never had a need to try it.
    Maybe the real technical gurus have some ideas for that.

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

Similar Threads

  1. Prevent Pinning of Access to Taskbar
    By Perceptus in forum Access
    Replies: 8
    Last Post: 07-07-2015, 11:33 AM
  2. Replies: 9
    Last Post: 10-20-2014, 08:43 PM
  3. Access Icon Size?
    By WhiskyLima in forum Access
    Replies: 2
    Last Post: 11-28-2013, 05:20 AM
  4. Replies: 1
    Last Post: 03-20-2013, 07:04 AM
  5. How to retrieve my Access icon?
    By djclntn in forum Access
    Replies: 8
    Last Post: 08-07-2012, 08: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