Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change length of control to match length of form

Status
Not open for further replies.

pdeman

Programmer
Feb 17, 2010
39
GB
Hello

I have an access form called Form1 which opens as a standard form no popup etc and it can be maximised and has sizing handles. Its opening dimensions are 15cm x 10cm.

The form has a box / rectangle control called Box1 which is set to 15cm in length.

When the form opens the rectangle matches the length perfectly however when you maximise the form or change its size by dragging the sizing handles the rectangle length of course doesn’t change.

I need the rectangle to equal the length of the form at all times i.e. when it opens when its maximised and when the sizing handles are dragged.
 
Your code might look something like:
Code:
Private Sub Form_Resize()
    Dim intRightMargin As Integer
    Dim intBottomMargin As Integer
    intBottomMargin = 250 [green]'depends on navigation and scroll bars[/green]
    intRightMargin = 400 [green]'depends on record selector and scroll bar[/green]
    Me.Box1.Height = Me.InsideHeight - (Me.Box1.Top + intBottomMargin)
    Me.Box1.Width = Me.InsideWidth - (Me.Box1.Left + intRightMargin)
End Sub

Duane
Hook'D on Access
MS Access MVP
 

... and don't forget screen units are in [blue]twips![/blue]

1" = 1440 twips

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Thank you all

I have implemented it and works perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top