Form size on screen in Access ?

I have some forms in Access 365 which CAN be shown on the screen WITHOUT scrollbars.

But when I start them I MANUALLY have to adjust the scrollbar (up/down) until the form fits right on the screen - and then the scrollbar disappears.

I have the properties (translated from DANISH version) Autocentering, Autosize and 'Fit to screen' all set to YES.

How can I correct that behavior by properties or by code, so I have NO scrollbars when the forms comes up on screen ?

* Please try a lower page number.

* Please enter only numbers.

* Please try a lower page number.

* Please enter only numbers.

I assume you are using overlapping windows, not tabbed documents?
With Joy Wend Your Way

3 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

If there is empty space on top of the form and on the left side, then what you need to do is to paste the form not in the center but to the right corner or at least close to it. I went into this method last year:

From this answer (URL): https://answers.microsoft.com/en-us/msoffice/forum/all/access-2016-in-runtime-opens-forms-off-center/1d29d387-bf63-4099-8ca9-eaca3ad45a76

-----------------------------------------------------------------------

It occurred to me, looking back to my DOS (pre-Windows) days that there had to be a way to place a form on an exact point on the screen, just as it's so obvious for the various elements that are placed within a form (ie the Top/Left properties).

I found it for MS Access forms- try this:

1) Set the form's AutoCenter property to "No."
2) Look up the MoveSize method in VBA help.
3) The uppermost, left corner of your screen would be 0,0. In the form's On Open event, place this function:

DoCmd.MoveSize 0,0

To take it a bit further, note that all measurements are in Twips (1440 per inch). You'll have to do the math to convert inches to cm. To set your form to a specific position in the window (I'm using inches measurements). For example, code the Form's On Open Event:

DoCmd.MoveSize 3 *1440, 4 *1440

3 inches from the left edge of the screen, 4 inches down from the top
of the screen.

To set another form's position similarly to position it .6 inch below the
Form1. Code the Form2 Open Event:

DoCmd.MoveSize 3*1440, 4.6* 1440

Also 3 inches from the left edge of the screen, but 4.6 inches down
from the top of the screen.

Adjust the actual placement as required.

Does this solve your position problem?

-----------------------------------------------------------------------

That might do it for you. If it doesn't, send us a screen capture of what's happening.

Al

I am a fellow user in this user-to-user forum on MS Access and MS Word forums. If my suggestions help you, please acknowledge this post as answered below.

Al Borges

2 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

> GroverParkGeorge

I don't get you ... I have a form with a size that is SMALLER than the screen anyway it is shown a little up from the midlle of the screen so the vertical scrollbar appears.

Manually I can fiddle with the V-scrollbar so the form is placed in the middle and the scrollbar disappears.

I have some othe way SMALLER forms - NO problem here - they show up right in the middle where they shoould.

It LOOKS like there is some invisible/hidden margin OUTSIDE the form itself !

In the way smaller forms the invisible/hidden margin makes no problem because there is lots of space between the form border and the screen border BUT when the form get bigger and close to the size of the screen THEN the invisible/hidden margin makes problems !

... is that clear as mud ?

It seems a little out of reach if I have to place the form by moving it around twips by twips !

Best regards
KeldSor
Aarhus V, Denmark

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Actually, I didn't post that response about twips and MoveSize....

I asked a clarifying question (which I am prone to do). I asked if you are using Tabbed Windows or Overlapping Windows, with the assumption that it would be Overlapping Windows.

It would seem that you have identified the problem pretty well in any event. My only suggestion, short of going down the path Al suggested, would be to make sure that all of your forms are sized and placed where you want them, and then Saved before closing.

With Joy Wend Your Way

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Why so many words, and so few screenshots?

-Tom.
Microsoft Access MVP
Phoenix, AZ

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Reply In reply to deleted message

I'm completely lost at what the problem was too. Usually, forms fall off the side and bottom of the screen. Case in point- my hospital's Sorian Electronic Medical Record (a $14 million dollar EMR) does that, and depending on your computer screen, these issues really make navigation difficult.

I agree- screenshots would really make this intriguing issue much easier to understand...

Al

I am a fellow user in this user-to-user forum on MS Access and MS Word forums. If my suggestions help you, please acknowledge this post as answered below.

Al Borges

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Ha, ha, .... I tried to explain what the problem is in my postings ... sorry for my english - danish is my first language, not english.

But I got the message ... you wants some screendumps ;-), and here they are - but I have to say some words too:

Here is my main menu form as it comes up in the Access enviroment just after I dobble click on it:

Notice it has a V-scrollbar to the right and there is plenty of space 'under' the form.

I can manually adjust the V-scrollbar to fit the form in the enviroment - and the V-scrollbar disappears again - look here, and I admit the height of the form is close to the avaiable space on the screen but it CAN fit there (unless there are some of what I called 'outer margin' outside the frame of the form !):

I would think the properties in the circle her is what SHOULD control that behavior:

But obviously the form does:

1) NOT Autocenter - at least not UP/DOWN

2) it DOES Autosize - I beleave it has to do with the 'outer frame' around the form - it adapts to the size of the form when shown

3) I think this is the 'reference' used in 1) to Autocenter - which it unfortunately doesn't do !

Hope that clears up the mud !

Please explain if I misunderstood these properties - and then tell how they are to be used.

Best regards
KeldSor
Aarhus V, Denmark

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Now I understand the issue- try setting the form's POPUP property to "Yes" and this will get rid of the vertical sidebar totally, and will allow the Autocenter property or MoveSize to work.
I am a fellow user in this user-to-user forum on MS Access and MS Word forums. If my suggestions help you, please acknowledge this post as answered below.

Al Borges

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Now I understand the issue- try setting the form's POPUP property to "Yes" and this will get rid of the vertical sidebar totally, and will allow the Autocenter property or MoveSize to work.

Unfortunately I have some data that will NOT be shown if the form is made to a POPUP.

I then search for a solution out there and found some code and tried it :


Public Function ksCenterForm(parForm As Form) As Boolean
    Dim varAccess As typRect, varForm As typRect
    Dim varX As Long, varY As Long
    On Error GoTo CenterForm_Error
    Call apiGetClientRect(hWndAccessApp, varAccess) ' Get the Access client area coordinate
    Call apiGetWindowRect(parForm.hwnd, varForm)    ' Get the form window coordinates
    varX = CLng((varAccess.left + varAccess.Right) / 2) - CLng((varForm.Right - varForm.left) / 2) ' Calculate a new left for the form
   
    varY = CLng((varAccess.Bottom - varAccess.top) / 2) - CLng((varForm.Bottom - varForm.top) / 2) - 20   ' 17-01-2020 Korrektion af KS
                                                                                                          ' for at undgå scrollbars på HP-EliteBook
   
    Call apiShowWindow(parForm.hwnd, SW_RESTORE) ' Restore form window
    Call apiSetWindowPos(parForm.hwnd, 0, varX, varY, (varForm.Right - varForm.left), (varForm.Bottom - varForm.top), SWP_NOZORDER Or SWP_SHOWWINDOW Or SWP_NOSIZE) ' Set new form coordinates
    ksCenterForm = True
    Exit Function
CenterForm_Error:
    FejlMeld ("Fejl ved centrering af form !")
    ksCenterForm = False
End Function

It seems to work better, BUT I still have to adjust with "- 20" at the todays date in the middle of the code, and now I can run the DB on a EliteBook without any scrollbars comming up !

Maybe in the end it's the same code S A Marchall gave - but I did get this to work quicker then SAMarchall's code.

Thx for you input !

Best regards
KeldSor
Aarhus V, Denmark

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Helps a lot. It does indeed appear AutoCenter is not working perfectly. I will check this out some more, to see if there is a bug here that needs to be reported.
-Tom.
Microsoft Access MVP
Phoenix, AZ

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

* Please try a lower page number.

* Please enter only numbers.

* Please try a lower page number.

* Please enter only numbers.

 
 

Question Info


Last updated March 31, 2025 Views 13,998 Applies to: