Scroll bars not working properly

KasperBN

Registered User.
Local time
Today, 11:06
Joined
Jan 17, 2013
Messages
48
I am working in Access 2010, and in my original forms, the vertical scroll bar works as intended.

However when I use the navigation tabs, the user has to use the horizontal scroll bar to scroll over to find the vertical scroll bar, which can seem confusing. I have attempted to find a fix in the properties, but could not seem to find it. I am posting some screenshots to further explain what I mean.

Thank you in advance for any help.
 

Attachments

  • Scroll bar 1.jpg
    Scroll bar 1.jpg
    100.9 KB · Views: 178
  • Scroll bar 2.jpg
    Scroll bar 2.jpg
    97.3 KB · Views: 215
Looks like you subform is wider than can be shown on the screen

Suggest put the following in your main form resize event

Code:
yoursubformname.width=insidewidth-yoursubformname.left-60
yoursubformname.height=insideheight-yoursubformname.top-60

This also means you can set the mainform scroll bars to neither as the become superfluous for this form
 
I can't seem to find the form resize. Is this under the properties of the original form or under the navigation tab?
 
You want your main form and you will find it under properties - events

see attached - it is about 20-30 lines down
 

Attachments

  • ScreenHunter_01 Mar. 22 11.26.gif
    ScreenHunter_01 Mar. 22 11.26.gif
    23.8 KB · Views: 158
Should the code look like this then?

Option Compare Database

Private Sub Form_Resize()
yoursubformname.Width = InsideWidth - yoursubformname.Left - 60
yoursubformname.Height = InsideHeight - yoursubformname.Top - 60
End Sub
 
i think doing stuff in the form resize is only going to help if a user does actually resize the form. You may need this code in the form open event as well.

does the display work ok on your monitor? are the users using different size screens, or do they have different resolution?

I think there are limits to what you can do. the change proposed may make a form that works OK on some monitors, become too narrow.

what I do in startup code is check the resolution they have, and if the vertical or horizontal resolution is insufficient, warn users that they may have problems.
 
Almost! - you just need to change yoursubformname to the name of your subform
 
Resize is an event that runs when a form opens - I use it extensively - primarily for smaller screens so the scroll to the right is not lost

There is a potential bug if the actual mainform width is less than the subform.left value (ditto equivalent for height) but this is easily fixed with on error resume next
 
There will be alot of users using this database, so the screen sizes will vary alot. The display works ok on my computer on the original form itself, but in the navigation form (the subform of the original form), the subform is too wide and there the scrollbar is too far on the right.
 
I get a runtime error 424 when attempting to use this code :( Here is my code for my forms (this is for one).

Private Sub Form_Resize()

Markets.Width = InsideWidth - Markets.Left - 60
Markets.Height = InsideHeight - Markets.Top - 60

End Sub

Does it make a different I have not coded the compare database option as you have?
 
Does it make a different I have not coded the compare database option as you have?

It should be there - right at the top of the code module - also have you located the code in your main form and check 'markets' is the name of the subform control (not the name of the subform) - I should have been a bit clearer

See my example in my last post - FrmFilter is the main form
 
Last edited:
I am still getting the runtime error 424 - object required.

I have put the options compare database in and it looks like this now:

Option Compare Database

Private Sub Form_Resize()

Markets.Width = InsideWidth - Markets.Left - 60
Markets.Height = InsideHeight - Markets.Top - 60

End Sub

Yes I have downloaded your example, however I am unsure what you mean. My main form is Markets, as an example, and the subform used in the Navigation Tabs, is "captioned" as Markets.

Would the actual name be "NavigationButton112" , as shown under the VBA?
 
The name of your subform can be found by opening your main form in design view, right click on the subform and select properties (if not shown), then select the 'other' tab. The subform name is the value against Name
See attached based on the file I provided. In this case the name of the control happens to be the same name as the subform itself but may not be in you case.
 

Attachments

  • ScreenHunter_02 Mar. 22 13.11.gif
    ScreenHunter_02 Mar. 22 13.11.gif
    21.5 KB · Views: 117
i think this is slightly the wrong syntax

Markets.Width = InsideWidth - Markets.Left - 60

if markets is the name of your subform the syntax is more likely to be

Markets.form = InsideWidth - Markets.Left - 60
 
Just to follow up. Based on the screenshots you sent, your main form is called Navigation this is where the code should be, and you subform control is on this form

Dave - The code adjusts the size of the subform control, not the form - I use it when the subform is in datasheet style which is what the poster has
 
I am still getting this runtime error 424. This is how my code looks :

Option Compare Database

Private Sub Form_Resize()

NavigationButton116.Width = InsideWidth - NavigationButton116.Left - 60
NavigationButton116.Height = InsideHeight - NavigationButton116.Top - 60

End Sub

I found this subform name under the Navigations Tab form, for markets. I will post a few screenshots showing my process.
 

Attachments

  • Scroll bar1.jpg
    Scroll bar1.jpg
    92.6 KB · Views: 97
  • Scroll bar2.jpg
    Scroll bar2.jpg
    91.2 KB · Views: 111
  • Scrollbar3.jpg
    Scrollbar3.jpg
    95.6 KB · Views: 91
Alright I just read your reply and I will try this. Same code name but repeated for every subform name I assume.
 
Option Compare Database

Private Sub Form_Resize()

NavigationButton116.Width = InsideWidth - NavigationButton116.Left - 60
NavigationButton116.Height = InsideHeight - NavigationButton116.Top - 60
NavigationButton112.Width = InsideWidth - NavigationButton112.Left - 60
NavigationButton112.Height = InsideHeight - NavigationButton112.Top - 60
NavigationButton118.Width = InsideWidth - NavigationButton118.Left - 60
NavigationButton118.Height = InsideHeight - NavigationButton118.Top - 60
NavigationButton114.Width = InsideWidth - NavigationButton114.Left - 60
NavigationButton114.Height = InsideHeight - NavigationButton114.Top - 60

End Sub

Under navigation
 
Just an update, I assume I was wrong in doing it this way. As I just received runtime error 2100. Does this mean I managed to change the width, heigh of the Navigation buttons themselves and not the subforms in the navigation form?
 

Users who are viewing this thread

Back
Top Bottom