Results 1 to 4 of 4
  1. #1
    ChaseC is offline Novice
    Windows 10 Access 2007
    Join Date
    Aug 2017
    Posts
    18

    Dynamically adjust the size of a subform based on visible/non-visible controls

    Hi lads,



    I've got a form that my users use to look at and interact with stored data. On this form I have a number of text boxes and combo boxes that provide users with ways to filter the data in the subform (which is a data sheet). The filter options take up a lot of room, so I want to be able to hide them at the click of a button and show then when a button is pressed again. In the first image, that is what it looks like when the form launches (data removed for privacy). When you click the filter button to the left, the hidden filter controls all turn to visible, and I'm wondering how I can automatically make the datasheet shift to the right to accommodate them (as shown is the second picture). I know this can be done by adjusting the .Width/.Position properties of the subform control but I'd like to avoid this if possible as it makes it difficult to change in the future if I need to change the size of the form.

    Thanks in advance!

    Click image for larger version. 

Name:	Screenshot1.PNG 
Views:	16 
Size:	13.2 KB 
ID:	33837Click image for larger version. 

Name:	Screenshot2.PNG 
Views:	16 
Size:	18.6 KB 
ID:	33838

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,987
    It may be easier to manage if your datasheet is a subform
    It should automatically shift to the right but do you want each column to shrink so you can see them all without scrolling?

    Another suggestion to consider before going any further
    Why not display your filter controls in 2 horizontal rows above or below your datasheet / subform
    This would have less impact on the datasheet & may make hiding the filters superfluous.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    ChaseC is offline Novice
    Windows 10 Access 2007
    Join Date
    Aug 2017
    Posts
    18
    Thanks for your response. The pictures show just one small portion of a larger overall "Home" page. The Home page is more limited in vertical space than it is horizontal space so I'd prefer to keep the filter controls on the side of the subform if possible. I much prefer having a datasheet subform so I can give users the freedom to rearrange/resize the columns as they see fit.

    Edit: Sorry I misunderstood, I thought you recommended that instead of having a Datasheet I should use a continuous form. The datasheet is already a subform and it does not automatically shift.

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,987
    Surprised it doesn't shift.
    So you aren't worried about resizing columns as you let users do that for themselves.

    Can you post the relevant part of your database after removing any confidential data
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 17
    Last Post: 08-03-2017, 06:08 PM
  2. Replies: 1
    Last Post: 03-21-2016, 10:40 AM
  3. Replies: 30
    Last Post: 07-21-2014, 02:46 PM
  4. Replies: 2
    Last Post: 01-06-2011, 04:38 AM
  5. Replies: 10
    Last Post: 12-31-2010, 12:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums