none
Subform maximizes after key press RRS feed

  • Question

  • Hello there

    I'm having some trouble with a form in Access 2016. I basically have one main form (frmNavigation) including a subform control which holds 11 subforms. Now whenever a button inside a subform has focus and I press a button the subform control maximizes and fills out the whole screen, resulting in an inability to navigate between the individual forms. The title of the form still holds the caption of the main form, and if I switch to design view and back to form view everything is the way I want it again.

    I already enabled key preview on all subforms and the main form, but it didn't change anything. After having searched google for quite some time now and having nothing found I'm out of ideas what to do. I hope some of you have experienced the same thing and could help me out!

    Thanks

    Wednesday, December 13, 2017 1:01 PM

All replies

  • It would seem probable that you have code behind one or all of the subform's buttons that is causing the thing to be maximized.

    Since this seems like such an obvious conclusion to arrive at, it may well be that you have considered the same thing, and have looked for such code already.

    You might also look for code in the Enter event of the Subform control.


    • Edited by KorLibrary Wednesday, December 13, 2017 1:07 PM
    Wednesday, December 13, 2017 1:06 PM
  • Thanks for your reply. Unfortunately it's not that easy..

    Even if I create a new empty form with a single button without any code behind it, the same thing happens.

    Wednesday, December 13, 2017 1:16 PM
  • A new empty form with a subform, or just a single form with a button?

    Whatever the case, you may have some corruption. You might try those steps in a new, empty database.


    • Edited by KorLibrary Wednesday, December 13, 2017 1:25 PM
    Wednesday, December 13, 2017 1:23 PM
  • A new empty subform with a button that does nothing attached to the subform control I'm using in my main form
    Wednesday, December 13, 2017 1:26 PM
  • The subform control can only host a form (subform) or a report. The button, then, must be 'attached' to the subform (meaning that it is a member of the Controls collection of the subform).

    I would try the same steps in a new, empty database. If this arrangement works as expected, I would suspect that your working database is corrupt, in which case I would make a backup copy, then /decompile it, then compact and repair.


    • Edited by KorLibrary Wednesday, December 13, 2017 1:35 PM
    Wednesday, December 13, 2017 1:33 PM
  • I've rebuilt the main form and after each change checked if it was still working. That way, I've found the setting that was causing all the trouble: The subform was bigger in height than the screen itself. If I make the subform smaller than the screen height it works perfectly. I still don't know why though...


    • Edited by sh4d0wstr0ke Wednesday, December 13, 2017 2:18 PM
    Wednesday, December 13, 2017 2:18 PM
  • Beats me. The Subform Control should not grow in size, no matter the size of the subform it is hosting, except when previewing the Form for printing, and when the Subform Control's CanGrow property is set to True. In any case, I can't imagine why a subform's dimensions would ever be greater than the screen size.

    I do suggest that while developing an Access application, you regularly /decompile it, recompile it, compact and repair it, and make a backup copy - at least daily. Ensure that Option Explicit is On in all code pages, except in rare cases where it must be Off.

    You mentioned that you are hosting 11 subforms in the Subform Control. I assume that you are swapping out the hosted subform as needed, as only one of the 11 can be hosted in a Subform Control at any given time. While this sort of thing is not unheard of (I do it myself), it makes it essential that your database be in top health at all times.

    But you also mention navigating between the individual forms - it is difficult to imagine exactly what you're doing. It strikes me as unusual, based on your description.


    • Edited by KorLibrary Wednesday, December 13, 2017 2:51 PM
    Wednesday, December 13, 2017 2:49 PM
  • Hello,

    Since you have found the cause, i think the solution is to let the subform is smaller than screen and i suggest you mark your post or helpful post as answer to close this thread. Or is there any specific reason you need to set a large height of subform?  How do you set to let the subform is bigger in height than the screen?

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, December 14, 2017 7:50 AM
    Moderator
  • I'm sorry, I mixed up some terms. What I meant was this:

    The main form acts as a navigation, holding a navigation control which should pretty much fill out the whole screen except a small part at the top displaying the logo of the company I'm working at. The navigation control holds eleven subform controls, each one of the subform controls hosts a different form. 

    I wanted to make sure the navigation control would always fill out the whole screen even if you opened it on a larger screen than the one I'm developing on, so I just made the navigation control really big.

    I guess I'll have to adjust the size of the navigation control using VBA.

    Anyway, thanks a lot for your answers!

    Thursday, December 14, 2017 9:12 AM
  • Hello,

    Thanks for the information. I think there is no need to adjust the size. It would auto resize if you let the navigation control fill out the detail section. 

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, December 14, 2017 9:40 AM
    Moderator
  • Ah! I understand now, thank you. I have not used the NavigationControl before, but I experimented with it.

    I suggest that you set the Anchoring of the NavigationControl (the top portion) to 'Stretch Across Top' and the NavigationSubform (the bottom portion) to 'Stretch Down And Across'.

    ...or, some combination of anchoring that befits whatever orientation possiblities this control has.

    Thursday, December 14, 2017 3:00 PM