Form opens in middle of screen

ikzouhetnietweten

Registered User.
Local time
Today, 14:14
Joined
Oct 23, 2015
Messages
44
My form doesnt open on top.. how do I make it open where I see the top and all the tabs of my form?
Something with Me.move 0,0 on the Onload ? That didnt work. The form setting Moveable cant be set to Yes somehow.
 

Attachments

Check the form property/format tab from DESIGN view. Once the form has been activated, these properties might not be changeable (i.e. at runtime, it is too late to alter these.)

"Auto Center" - should be NO.
"Moveable" - should be YES.

Remember that during the Form_Open routine, the form is not visible on screen yet, though you can "see" controls using VBA. In the Form_Load event routine, however, you can still affect the visual aspects of the form.

One possibility (if it is consistent with your design goal) is that you can execute a "DoCmd.Maximize" followed by a "Me.Repaint" from the _Load event code. This works on the parent window. If the form in question is a child window of the Access application, you can manipulate the form by externally setting its .Top and .Left properties.

You can use the WMI library to find out about the setup of the parent app window. Remember that things like window handles are usually 32-bit integers (LONG).

Use this to get the window handle:

hWnd = Application.hWndAccessApp

Having the window handle, you can use the WMI interfaces (which you should research separately, as they are complicated) to manipulate the window position. I would recommend some Google-search work through the MDSN library to find out about window placement and how to muck with placement.

Remember that if you have parent/child windows such as but not limited to switchboards, the parent window is an applications window but the forms are child windows of the application, which makes them have a different characteristic. I have not recently worked with this, but I believe that if you have a child window, the Maximize function is relative to the parent (app) window, but for the app window, Maximize fills the entire desktop. Therefore, if you want a child window to fill the screen, maximize the parent first, then maximize the child.

Similarly, positioning the child window is always RELATIVE to the app window. Therefore, if you want the child to be at absolute location 1 inch from the top of the desktop and 1 inch from the left of the desktop, the parent / app window must include that position. I also emphasize that it has been a while since I've played with this so I might have forgotten (or Microsoft might have adjusted) some of the nuances of this topic.
 
It appears your NavigationSubform control is a bit long. I reduced the length to 7 1\2 and the problem went away.
 

Attachments

  • NavigationSubform.jpg
    NavigationSubform.jpg
    87.2 KB · Views: 108
Thank you for your answers.
Autocenter was already set to NO, and Moveable cant be set to YES as stated in my first post.

I tried the repaint but didnt do anything either
Private Sub Form_Load()
DoCmd.Maximize
Me.Repaint
End Sub

I guess its like AccessBlaster says, its too big, so it does indeed work if I just resize it so it exactly fits. I just think its weird it cant be loaded on top instead of in the middle.
 

Users who are viewing this thread

Back
Top Bottom