Search code examples
ms-accessscrollscrollbarhorizontalscrollview

Is there a programatic way to deal with subform / scrollbar situations in MS Access?


subform 'frm_Stage' window limiation

SHORT DESCRIPTION: I need to see all the columns in a datasheet subform. Specifically - 12 columns of months. To do that, I need a horizontal scroll bar. To get to that scroll bar is a challenge. I am developing in MS Access 2007.

THOROUGH DESCRIPTION: I have a subform 'frm_SP' which displays in datasheet view that is 22" wide which is limit in width for a form - it is nested in another subform called 'frm_stage'.

I finally discovered that no matter how wide I make the very top "Parent form - 'frm_Entry' I can't seem to make ALL of this 3rd nested subform 'frm_SP' visible. The horizontal bar at the bottom just seems to compensate by proportionately growing to keep the limitation intact - this is frustrating.

As you can see in this image below, I have to scroll down to see the horizontal scroll bar. Why is it so far down? Did I specify that somewhere? It keeps that distance no matter how many records exist in the datasheet. So if it only had 4 records, I'd still have to scroll all the way down to see the scroll bar. Similarly, I have a set of records that go beyond the horizontal scroll bar and I have no way of making the window large enough to see those records. So I have had to tell the client to open the actual table if they need to edit those records.

I have hesitated to post anything like this because it requires images, but now that I have done the work, hopefully this can solve a lot of issues for other users. Maybe this is the reason that there aren't many answers on the web that I can find.

Any tips, suggestions for alternate methods are welcome.

unnecessary space below the last record in the datasheet of frm_SP

I added "SendKeys" code for the arrow keys so that that the 12 boxes would function more like a spreadsheet. But I don't understand why January is skipped and then it continues to skip every 2 boxes

Here is the code:

Private Sub txtDEC_NC_KeyDown(KeyCode As Integer, Shift As Integer)
 Select Case KeyCode
        Case 40 'down
            SendKeys "{TAB}", False

        Case 38 'up
            SendKeys "+{TAB}", False

    End Select
End Sub

Solution

  • If you haven't already, try increasing the size of your 2nd-level form (as well as the subform control on that 2nd-level, which houses the bottom level form).

    It looks like your bottom level form (with a max width of 22") requires a horizontal scroll bar in order to display within your 2nd-level form. This causes the scroll bar to appear within your 2nd-level form (where you have to scroll-- within the top form-- down in order to see it).

    Instead, you probably would prefer that scroll bar to appear on your top-level form, which I believe you will get if your 2nd-level form (and the subform control for your bottom-level form) are also set to a max-width of 22".

    The bottom level form will then display within the middle form without the need for a middle-form scroll bar, and the one (and only) scroll bar will render on the top form, where it will always be easily accessible without the need to scroll down first.

    I have some thoughts on what causes the extra vertical white space in your second form, but I wonder if the above might not solve your problem.

    Just a thought. (And I realize that this is a very old question, so perhaps you no longer need any suggestions here--in that case, I'll just leave this comment for others who may have a similar issue in the future).