DoCmd.Move Size is ignored

kirkm

Registered User.
Local time
Tomorrow, 01:27
Joined
Oct 30, 2008
Messages
1,257
DoCmd.MoveSize 1, 10, 100, 1000

I have the above in Form_Load and can change these values but the Forms position and/or size will not change.
I have Properties-Pop Up set to Yes, and autocenter No
 
It could be you need to select the form before the MozeSize

Try this tested code.

Code:
Option Compare Database
Option Explicit

Private Sub Form_Load()
  
    ' make sure the correct object is selected
    DoCmd.SelectObject acForm, Me.Name


    DoCmd.MoveSize 1, 10, 100, 1000


End Sub

*** The above code was copied from a form where it worked as you coded the MozeSize
 
Tested and it works for me without SelectObject.
 
DoCmd.MoveSize 1, 10, 100, 1000

I have the above in Form_Load and can change these values but the Forms position and/or size will not change.
I have Properties-Pop Up set to Yes, and autocenter No
Hi. Not sure why it's not working for you either, but you could also try to use the form's Move method instead.
 
It worked fine for me also without the select object in my testing.

If something has grabbed the focus, the MoveSiz may be trying to apply it to the incorrect object. I fidn this to be the most common cuase for teh MoveSize to not work as desired.

I prefer to be as explicit as possible with my VBA code. Never let Access guess what I want.

I found that adding the SelectObject before the MoveSize gives you a much better chance of it working on the desired object.

It has served me well for over 20 years.
 
FYI: The Form.Move does not work the same as MoveSize.

Code:
Me.Move 1, 10, 100, 1000
the above code positions the form relative to the Access document window (below the ribbon and right of the Nav Pane)
 
Last edited:
Many thanks for the help and it's now working.. Although I was sure MoveSize was originally the only command in
Form Load, I'd since added

'select the navigation pane
Call DoCmd.NavigateTo("acNavigationCategoryObjectType")
'hide the selected object
Call DoCmd.RunCommand(acCmdWindowHide)

Putting MoveSize before that now works. I must have had something wrong to start with.
 
Thanks for the update.

Glad you got it working.

kirkm, great job! (y)
 

Users who are viewing this thread

Back
Top Bottom