Hi Kevin
To accommodate all the records in a continuous form, the form’s height should be at least:
<height of header> + <height of footer> + (<height. of detail> x <number of records>)
In VBA, for a subform, this would translate to:
Dim lRequiredHeight As Long
With Me.SubformControlName
With .Form
lRequiredHeight = .Section(acHeader).Height + .Section(acFooter).Height + .Section(acDetail).Height * .Recordset.RecordCount
End With
.Height = lRequiredHeight
End With
Be careful though, because the height of the section on your main form that contains the subform control must be sufficient to contain the newly sized control, otherwise an error will occur.
It would probably be better to anchor the subform to the top and bottom of your main form so that it resizes automatically. Then you can change the height (Me.InsideHeight) of your main form to suit, or just allow the user to resize it with the mouse.
All the best!
Graham [Access MVP since 1996]
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Friday, 25 September 2015 02:06
To: MS_Access_Professionals <ms_access_professionals@yahoogroups.com>
Subject: [MS_AccessPros] How to grow or shrink subform according to the number of records?
Dear All,
Can anybody teach me how to grow or shrink a subform according to its number of records? Thanks in advance.
Regards,
Kevin
Posted by: "Graham Mandeno" <graham@mandeno.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (4) |
Tidak ada komentar:
Posting Komentar