Anyone know how to use DoCmd.RunCommand acCmdAppSize? (1 Viewer)

Evad973

New member
Local time
Today, 07:54
Joined
Jun 29, 2023
Messages
2
I'm quite new to access so please bear with me!
I'm trying to make the main application window become a certain size when I open a form. I found a youtube video which showed how to maximise and restore a form using DoCmd.RunCommand acCmdAppMaximize or CmdAppRestore. I noticed a command acCmdAppSize but there is no help on the extra text you need to write to set the actual size. I've tried a few obvious combinations but can't seem to get it to work.
Any one know if this command should do what I'm looking for, and if so how to use it?
thanks
 

CJ_London

Super Moderator
Staff member
Local time
Today, 07:54
Joined
Feb 19, 2013
Messages
16,612
Is the form a popup? Or are you using tabbed or overlapping windows? Makes a difference to the answer

those commands affect the application window, not the form.
 

Evad973

New member
Local time
Today, 07:54
Joined
Jun 29, 2023
Messages
2
Is the form a popup? Or are you using tabbed or overlapping windows? Makes a difference to the answer

those commands affect the application window, not the form.
Hi, thanks for replying.
Its the main window that I want to set to a specific size.
When I open my database I want the main window to be a particular height and width. In Options I have set the Current Database Display Form to be frmTimesheet. When the form opens (On Open event) I have then added the following code:

Private Sub Form_Open(Cancel As Integer)

DoCmd.RunCommand acCmdAppSize

End Sub

I got this from the video that showed how to do it for acCmdAppMaximize (which worked fine). I substituted acCmdAppSize but I don't know what other text I need to add to actually tell it the size I want.

In the Current Database options I have Tabbed Documents set, with Display Document Tabs turned off which is how I'd like to keep it.
Any idea on the arguments for acCmdAppSize?
I viewed the post "How to set ms access main application window on restore size fixed" but it didn't do what I wanted and it was also a bit beyond my current understanding.
Pop up and Modal are both set to no for the frmTimesheet form.
 

sonic8

AWF VIP
Local time
Today, 08:54
Joined
Oct 27, 2015
Messages
998
My understanding is that the acCmdApp... commands are just equivalent to the user clicking on the system menu for minimize/maximize/restore or are just starting a move/size operation, but the users must manually complete them by defining the new position/size with the mouse.

For moving/resizing Access forms inside the application, you can use DoCmd.MoveSize. For moving/resizing the application window itself, you can use Windows API functions, e.g., SetWindowPlacement.
 

bastanu

AWF VIP
Local time
Yesterday, 23:54
Joined
Apr 13, 2010
Messages
1,402
I'm afraid you need to find another way to do that, looks like your current option is not what you want:
Here is a link that might help:
Cheers,
 

Users who are viewing this thread

Top Bottom