Long subform behaviour

Babycat

Member
Local time
Today, 14:01
Joined
Mar 31, 2020
Messages
291
Hi everyone

I have a long subform (continous) on Mainform. This subform is not on top of Mainform (its Top position is not 0)
Everytime this subform got focus then the display screen will be "shifted down" to make subform first record in the top-left position of screen. It causes the mainform's fields are not fully shown.

Please advide how to fix this.

Attached are screenshot and sample access file.
(The issue does not happen if the subform height is fit into your screen, in other word if the subform is not long (tall) then no issue
Screenshot 2025-08-20 095952.jpg
 

Attachments

That's expected behavior. Afraid can't be long as you have and not get that. Need to reduce height of subform and box and main form so all parts can be viewed on smallest monitor this is intended to be viewed on. This is why forms have scroll bars.
 
Last edited:
Whilst I agree with June7 about shrinking the form / subform heights, the described behaviour doesn't happen for popup forms as they are independent of the Access application interface.
As the form supplied already is a popup form, it doesn't shift upwards when the subform gets focus.
 
That's expected behavior. Afraid can't be long as you have and not get that. Need to reduce height of subform and box and main form so all parts can be view on smallest monitor this is intended to be viewed on. This is why forms have scroll bars.
i have so many data fields on mainform while no tab-control is allowed, thus the mainform will be with vertical scroll bar in my design.
The current behaviour maximizes dipalying item on subform but it hides important fields on the top of mainform.
 
Whilst I agree with June7 about shrinking the form / subform heights, the described behaviour doesn't happen for popup forms as they are independent of the Access application interface.
As the form supplied already is a popup form, it doesn't shift upwards when the subform gets focus.
Yes. By set subform's PopUp property to Yes. The problem is solved.
Thank you very much.
 
I tried that with your db. No change in behavior.
Yeah, I have tried with my laptop this morning, it was OK when I set subform's Popup to YES
However, I am trying on my PC now (with bigger screen), the behavior is no changed. Confirmed.

Resize the mainform until vertical scroll bar appears. Then press button "Subfrm Focus", we can reproduce the issue.

1755707842938.png
 
I tested in a 22 inch monitor earlier. However, it shouldn't make any difference what size monitor you have with popup forms
 
I tested in a 22 inch monitor earlier. However, it shouldn't make any difference what size monitor you have with popup forms
I am with 28 inch monitor here (the issue can be reproduced), But i think it also depends on the resolution.

To reproduce the issue, you may try:
1. Go to design mode of mainform, make subform control high as much as possible
2. In form view mode, Resize the mainform until vertical scroll bar appears. Then press button "Subfrm Focus"
 
To reproduce the issue, you may try:
1. Go to design mode of mainform, make subform control high as much as possible
2. In form view mode, Resize the mainform until vertical scroll bar appears. Then press button "Subfrm Focus"
I had already tried both of those before posting
Taking point 2: it is illogical to make your form / subform very tall, then reduce it to show the vertical scrollbar

Just make the form shorter in the first place.
 
I had already tried both of those before posting
Taking point 2: it is illogical to make your form / subform very tall, then reduce it to show the vertical scrollbar

Just make the form shorter in the first place.
Hi Isladogs

Could you reproduce the issue at your side? Do you need me to capture the video?

As described in #4. I have form with many data fields and no tab-control is allowed.
The application is designed for big size monitor and it is working well. Recently, someone using application on small screen complains about this incovenient behaviour, therefore I am looking for a solution to fix it.
 
Put this in a module:
Code:
Public Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" ( _
    ByVal hwnd As LongPtr, _
    ByVal wMsg As Long, _
    ByVal wParam As LongPtr, _
    ByVal lParam As LongPtr) As LongPtr

And from your form:
Code:
Private Sub Command10_Click()
    Me.SubFrm_List.SetFocus
    SendMessage Me.hwnd, &H115, 6, 0&
End Sub

It basically sets the value of the vertical scrollbar to 0 after you set focus.
 

Users who are viewing this thread

Back
Top Bottom