CodeMed
CodeMed

Reputation: 9205

fitting forms to various screen settings in ms access 2010

I have a set of two nested navigation subforms in an ms access 2010 database. The problem is that, when different users on different machines view the database through different screen resolutions and text size settings, the forms can have silly wastes of screen real estate, such as in the following image:

How do I set the width and height of each navigation subform so that each of the two navigation subforms has a small inset (30 pixels?) at the right and bottom, assuming that the left and top are fixed?

Here is the code that I worked up so far, but it pushes things too far to the right and to the bottom, without leaving the insets that I need at the right and bottom:

Main form (this is the outermost form):  

Private Sub Form_Resize()
    On Error Resume Next
    Me.NavigationSubform.Width = Me.WindowWidth - (Me.NavigationSubform.Left + 10)
    Me.NavigationSubform.Height = Me.WindowHeight - (Me.NavigationSubform.Top + 10)
End Sub

FindClientsNavigation form (this is the second level form):  

Private Sub Form_Resize()
    On Error Resume Next
    Me.NavigationSubform.Width = Me.WindowWidth - (Me.NavigationSubform.Left + 10)
    Me.NavigationSubform.Height = Me.WindowHeight - (Me.NavigationSubform.Top + 10)
End Sub

I uploaded a simplified version of the database with enough to recreate the problem at this file sharing site.

If you want to recreate the problem on your pc after downloading the database, you can set the windows text size property using the following dialog in the control panel:

Upvotes: 0

Views: 12731

Answers (2)

Dzintars
Dzintars

Reputation: 1571

There is simple navigation available in ribbon. See the picture above.

enter image description here

Upvotes: 0

Chris Rolliston
Chris Rolliston

Reputation: 4808

Instead of messing about with code, set the HorizontalAnchor and VerticalAnchor properties of the subform controls appropriately at designtime, i.e. to Both. The default is for the horizontal anchor to be left only and the vertical anchor to be top only; setting to left-and-right and top-and-bottom will mean the control stretches accordingly when its parent resizes.

Upvotes: 2

Related Questions