How to hide the Main Acces UI

Lkwdmntr

Registered User.
Local time
Today, 11:46
Joined
Jul 10, 2019
Messages
287
I made this database and was hoping I could just open it and only see the forms pop up, no access UI. Is there a quick easy way to do this, or does it take tons of code?
 
As already stated in your other thread, see my example app Controlling the Application Interface. It includes module code needed to do this successfully.
However you will need to review the design of your existing forms to ensure these work properly with no ribbon, title bar & navigation pane as all functionality needs to be built into the forms
 
I am trying to decipher some of that code and it is very confusing. I was not thinking about using this in the database that you are familiar with, but another one that only has a few forms.

The code you provided seems to be for every type of control in the access application. I was just looking to hide the main window while keeping my forms on the desktop.
 
Hi. Just my 2 cents here, although what you want is very possible, I personally don't bother. I have seen people very happy with it, and I've seen others struggle with it. I would be interested to hear how your experience will be once you tried it. Good luck.


(Just one person's humble opinion...)
 
I don't think I would want to hide the UI completely in the large database project I have, but I just wanted to give it a try in this little program I made. It's just a simple ledger program. Adding, Editing and printing. Very small, I thought it would be nice to just open the file, hit a few buttons and not even see the UI. Just looking for some simple code to put into the onload event on my forms and reports.
 
I don't think I would want to hide the UI completely in the large database project I have, but I just wanted to give it a try in this little program I made. It's just a simple ledger program. Adding, Editing and printing. Very small, I thought it would be nice to just open the file, hit a few buttons and not even see the UI. Just looking for some simple code to put into the onload event on my forms and reports.
Hi. Re: "simple code"

It doesn't matter whether it's a small or a big project, the principle is the same. You will have to make all your forms "popup." So, between a small and a big project, it's just a matter of amount of work you'll have to do. There are other things you have to make sure, but like I said, they all apply to any project where you want to hide the Access UI. Cheers!
 
My example application was indeed designed to cover every possible scenario. Its unlikely any real application would need all that code.

Having said that, I use this type of code in many applications and its proved very popular with a lot of my clients.
I always hide the navigation pane and ribbon in every production database in order to 'lock it down' to standard users.
Hiding the ribbon also hides the quick access toolbar (QAT).
Occasionally I hide the taskbar but that's usually when I'm creating a kiosk mode application.

Hiding the application window will also remove the title bar and is probably most useful when forms aren't maximised so the form is 'floating on the desktop'

Even if you find the code complex all you need to do is import the relevant module(s) to your own app then copy the code from my example to e.g.the form load event of your forms
For example just add the lines HideNavigationPane and/or HideRibbon to do just that.

Hiding the application window is a little more tricky as its forcing Access to behave in ways it wasn't designed to do. Clearly, hiding the application window means the navigation pane and ribbon will also be hidden.

I agree that the API calls are difficult to understand but to be honest you can just copy the code I used depending on exactly what you want to do. You don't need to understand it fully.

If you have a specific question, do ask
 
One more thing.
You can hide the application window but you need to consider how to handle printing reports. There are two main solutions to that
1. Restore the ribbon when displaying the report in print preview then hide it again when you close the report
2. Display reports in report view and add a Print button to each report
 
One more thing.
You can hide the application window but you need to consider how to handle printing reports. There are two main solutions to that
1. Restore the ribbon when displaying the report in print preview then hide it again when you close the report
2. Display reports in report view and add a Print button to each report
Option #3 = Right-click > Print
 
True … but when I hide the application window, I'm partly doing so to restrict what standard users can do.
So I will usually also disable the right click context menu as well
 
True … but when I hide the application window, I'm partly doing so to restrict what standard users can do.
So I will usually also disable the right click context menu as well
No fair... :(
 
Hey Guy's,

Thanks for all the help with this. I was able to get it to work and I really like it. The only problem is when I push the buttons to pull up the reports, the report comes up as a thin line across the screen. I can maximize it and then hit control P to print, but was hoping it would just open as a pop-up like all the other forms.

I'll attach it so you can take a look if you want. I copied all the modules but only used the "SetAccessWindow (SW_SHOWMINIMIZED)" in the on-load event of the Main form loading at startup.
 

Attachments

Glad you like it.
See attached for one solution to your reports problems
I've made a few changes to your code to do this

There are other possible approaches as well
Also attached is a minor update to v3.45 of my utility.
It shows 3 ways of opening the same report with this type of application
NOTE: in this case the report is modal but not popup
To test each of these and decide which you prefer, click the following on the MainForm
a) Open New Form =>View Report
Opens report in Print Preview with ribbon

b) Open Report View
Opens report in report view with print button

c) Open Report (Preview)
Combines the above depending on whether the application window is visible or not.

Have a look at the code in each case to see what I've done
 

Attachments

Last edited:
It is now opening in "Report View", but full screen. Is it possible to have it show like the other forms?
 
Change the Report_Open code to DoCmd.Restore
The report will then appear on top of the form but the form is still visible underneath.
You may therefore want to close (or hide) the main form when the report is open and show it again when you close the report

Code:
Private Sub Report_Open(Cancel As Integer)
    DoCmd.Restore
    DoCmd.Close acForm, "MainMenu"
End Sub

EDIT Depending on whether you are using Tablet mode or not, that may work perfectly or it may revert to a narrow strip. If necessary try my other approaches or force the report to a specified size using DoCmd.MoveSize.
Also if you use ReportView you will need a Print button on the report
 
Last edited:
This was bugging me so I returned to it again
Updated version attached where both reports open 'floating on the desktop'as for the forms

Modified report code:
Code:
Private Sub Report_Close()
    DoCmd.OpenForm "MainMenu"
End Sub

Private Sub Report_Open(Cancel As Integer)
    Application.Echo False
    DoCmd.Restore
    DoCmd.Close acForm, "MainMenu"
End Sub

Private Sub Report_Resize()
       DoCmd.MoveSize 1000, 1000, 12500, 12000
       Application.Echo True
End Sub

NOTE:
1. You may need to modify the MoveSize values (in twips) to fit your monitor size/resolution
2. If you are using tablet mode, a further tweak may be needed
 

Attachments

You're welcome.
You will have realised that reports are somewhat harder to manage than forms in apps where the application window is hidden.
BTW you used the simplified version of the code used when the startup form is loaded. Be aware that using that code will cause the app window to reappear if someone clicks on the Access taskbar icon. Users may do that if they click on something else and then want to return to your app. To prevent that issue you need the more complex version of the code as used in my example app
 
Getting an Error Message Compile Error: Method or Data member not Found, for this part of the code - Me.cmdRestore.Caption = "Maximize Form".

This is for to hide the Access App Window On-Load. Could anyone help me with this? Thanks in advance.
Code:
Private Sub Form_Load()
On Error GoTo Err_Handler

   ' DoCmd.Maximize
 '  SetAccessWindow (SW_SHOWMINIMIZED)
  
    Me.Painting = False
    'omit the ...Or WS_EX_APPWINDOW ...section to hide the taskbar icon
    SetWindowLong Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_APPWINDOW
    ShowWindow Application.hWndAccessApp, SW_HIDE
    ShowWindow Me.hwnd, SW_SHOW
      
   'set startup conditions
   Me.cmdAppWindow.Caption = "Show Application Window"
   Me.cmdRestore.Caption = "Maximize Form"
   Me.cmdTaskbar.Caption = "Hide Taskbar"
   Me.cmdFillScreen.Enabled = True
   Me.cmdNavPane.Caption = "Show Navigation Pane"
   Me.cmdRibbon.Caption = "Show Ribbon"
   Me.cmdVBE.Caption = "Open the VBE"
   Me.cmdFormView.Caption = "Open in design view"
  
   Me.Painting = True
  
Exit_Handler:
    Exit Sub

Err_Handler:
    strProc = Application.VBE.ActiveCodePane.CodeModule.ProcOfLine(Application.VBE.ActiveCodePane.TopLine, 0)
    MsgBox "Error " & Err.Number & " in " & strProc & " procedure : " & Err.Description
    Resume Exit_Handler
'-----------------------------------------------------------------
    Me.Width = 10 * 1440
    Me.Detail.Height = 0.15 * 1440
    Me.Refresh
   ' Me.TimerInterval = 60000

End Sub
 
Last edited:
Getting an Error Message Compile Error: Method or Data member not Found, for this part of the code - Me.cmdRestore.Caption = "Maximize Form".

This is for to hide the Access App Window On-Load. Could anyone help me with this? Thanks in advance.
I still think it's a good idea to post a copy of your db to help us help you.
 

Users who are viewing this thread

Back
Top Bottom