HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

VBA Maximize Access Application Main Window

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
mainapplicationmaximizevbawindowaccess

Problem

I need my access application window to open up in full screen. I have tried using:

DoCmd.RunCommand acCmdAppMaximize


and

DoCmd.Maximize (which I think only maximizes a Form).


Neither is working for me? I put the VBA code in the OnLoad event and I also tried putting it in the Click Event of a command button.

I think i need to set focus to the actual Access Application (main window) first and then run the DoCmd.RunCommand acCmdAppMaximize command but am not sure how to achieve this.

I noticed that if I click the command button with DoCmd.RunCommand acCmdAppMaximize nothing happens but If first I move the window around (by dragging it's title bar) and then I click the button it will actually Maximize the Window.

Anyone had any luck with this before?

Update:

Not sure why but the only way i can get the

DoCmd.RunCommand acCmdAppMaximize


to work, is by first calling the

DoCmd.RunCommand acCmdAppMinimize (minimize window first)


and then calling the DoCmd.RunCommand acCmdAppMaximize (and then maximize)

Solution

I've spend a while battling with this problem too, reading various blogs and posts. I've found a very simple way to achieve the desired outcome in VBA using just one line of code. In the VBA editor, place this code AFTER your On Load code:

[Your On Load code]

KeyCode = 16

This code achieves the equivalent of pressing F11, ie maximising the view of the currently open window.

Context

StackExchange Database Administrators Q#57653, answer score: 3

Revisions (0)

No revisions yet.