Hi. Re: "simple code"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.
Option #3 = Right-click > PrintOne 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
No fair...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
Private Sub Report_Open(Cancel As Integer)
DoCmd.Restore
DoCmd.Close acForm, "MainMenu"
End Sub
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
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
I still think it's a good idea to post a copy of your db to help us help you.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.