Displaying an Access GUI without the default Access frame

14,646

Solution 1

To do so, I take advantage of a piece of code written by some clever guys and available on the net (I think it was originally written by Terry Kreft?) and referring to some windows API.

I have first this:

Declare Function apiShowWindow Lib "user32" _
          Alias "ShowWindow" (ByVal hwnd As Long, _
          ByVal nCmdShow As Long) As Long

Global Const SW_HIDE = 0
Global Const SW_SHOWNORMAL = 1
Global Const SW_SHOWMINIMIZED = 2
Global Const SW_SHOWMAXIMIZED = 3

and that

Function fSetAccessWindow(nCmdShow As Long)
      'Usage Examples
      'Maximize window:
      '       ?fSetAccessWindow(SW_SHOWMAXIMIZED)
      'Minimize window:
      '       ?fSetAccessWindow(SW_SHOWMINIMIZED)
      'Hide window:
      '       ?fSetAccessWindow(SW_HIDE)
      'Normal window:
      '       ?fSetAccessWindow(SW_SHOWNORMAL) 

      Dim loX  As Long
      Dim loForm As Form

   On Error Resume Next
   Set loForm = Screen.ActiveForm
   If Err <> 0 Then 'no Activeform
       If nCmdShow = SW_HIDE Then
           MsgBox "Cannot hide Access unless a form is on screen"
       Else
           loX = apiShowWindow(hWndAccessApp, nCmdShow)
           Err.Clear
       End If
   Else
       If nCmdShow = SW_SHOWMINIMIZED And loForm.Modal = True Then
           MsgBox "Cannot minimize Access with this form on screen:" & (loForm.Caption + " ")
       Else
           If nCmdShow = SW_HIDE And loForm.PopUp <> True Then
               MsgBox "Cannot hide Access with this form on screen:" & (loForm.Caption + " ")
           Else
               loX = apiShowWindow(hWndAccessApp, nCmdShow)
           End If
       End If
   End If
   fSetAccessWindow = (loX <> 0)

End Function

When starting my program, I will then call the function this way

'function is called by autoexec Macro'
...
fSetAccessWindow (SW_HIDE)
...
DoCmd.OpenForm my_Startup_Form
Forms(my_Startup_Form).Controls(my_Active_Control).SetFocus

The screen will 'flicker' a little bit, and the main window will appear briefly, then disappear. My focussed window will then be displayed alone.

Solution 2

Actually, most of the posts here are rather old and based on much older versions of Access. Since 2007 you can hide the interface with just a few mouse clicks and ONE LINE of code. Under file-Options->current database

Choose tabbed documents, choose hide document tabs. Un-check show navigation pane and also if you want to display the status bar.

Then in your startup form on load place this one line of code:

DoCmd.ShowToolbar "Ribbon", acToolbarNo

The result is this:

enter image description here So all these wild solutions with API, whacks of code etc. is not required unless one is looking to increase world poverty.

Just a few mouse clicks and one line of code to hide the Access UI been possible for the last 3 versions (2007 onwards).

Solution 3

Yes, you can. See "Setting Startup Options" from Basics for Building Microsoft Office Access 2003 Runtime-Based Solutions.

You can use the Startup dialog box to specify the following:

  • Whether or not the Database window should be displayed on startup.

Solution 4

If you create an MDE and run it under the Access Runtime, it will execute your program stripped of (most, if not all of) the Access GUI.

This is by design. The Access Runtime is intended to allow you to distribute a copy of your application, while depriving your users of the regular Access trappings.

Solution 5

No. Access is a classic Multiple Document Interface (MDI) where all the child windows are inside a parent window.

However, Access does have a lot of ways you can change the Parent Window Menu's and Toolbars. You can create your own menu and toolbar layouts that only have what you want in them. Google creating menu bars and toolbars in Access and it should point you in the right direction.

EDIT:

JP nailed it.... My brain forgot that little nugget....

Share:
14,646
TAD Innovative minds
Author by

TAD Innovative minds

I am a perpetual student, and always trying to learn something new. For those of you to take the time to answer, even when it requires helping the question along, I for one appreciate that effort greatly! I am currently mostly interested in nodejs, python, java, elasticsearch, kafka, forensics and ethical hacking.

Updated on June 09, 2022

Comments

  • TAD Innovative minds
    TAD Innovative minds almost 2 years

    Is there a way to tell access to only display the forms/reports without displaying the access window itself (the "shell" window that the access forms populate inside of).

  • Kevin LaBranche
    Kevin LaBranche over 14 years
    Even with an MDE you still have the parent window BUT the MDE does give you some extra's in it that make it very worthwhile.
  • Tony Toews
    Tony Toews over 14 years
    Note that there are all kinds of things you should know before deplying an app using the runtime. Such as ensuring you have a startup macro or form, the right mouse click menu no longer works, and you propably want to create your own abbreviated toolbar menus. See See my Microsoft Access ODE or MOD Runtime Installation Troubles Tips page at granite.ab.ca/access/runtime.htm.
  • Yinda Yin
    Yinda Yin over 14 years
    +1 I was trying to remember the exact setting. It's been awhile.
  • Kevin LaBranche
    Kevin LaBranche over 14 years
    Ah... I had completely spaced that! :)
  • David-W-Fenton
    David-W-Fenton over 14 years
    You really should include the URL of your source when you're using someone else's code. The URL for this is: mvps.org/access/api/api0019.htm , which is easily enough found by Googling the name of the function.
  • David-W-Fenton
    David-W-Fenton over 14 years
    Doesn't the right click continue to work when you've defined shortcut menus for your objects?
  • carveone
    carveone over 14 years
    Thanks David. I was planning to do that but I got caught by something uuuuuuurgeeeeeent (according to others!)
  • carveone
    carveone over 14 years
    A. , I guess it still woks in Access 2007, as it is related to Windows, not Office
  • Tobias Kienzler
    Tobias Kienzler almost 7 years
    Maybe I missed something, but it seems Access 2016 still shows an entirely empty background window. Can you confirm this still works?