Auto Height of Subform on base of records

ootkhopdi

Registered User.
Local time
Today, 21:48
Joined
Oct 17, 2013
Messages
181
Hi All

i have a subform (A) which shows records after an query

i want to set height of subform on base of records as some time query shows 2 records and some time it shows 10 records

how can i set auto height of sub form

pls give me solotion
 
in your main form current event have some code like this (change names to suit)

me.subformname.height=me.subformname.form.section(0).height*(me.subformname.form.count+1)

You may need to modify the height for the header depending on whether the subform view is datasheet or continuous and for other sections - see these links

https://msdn.microsoft.com/en-us/library/office/aa196572(v=office.11).aspx
https://msdn.microsoft.com/en-us/library/office/aa196556(v=office.11).aspx

height is measured in twips and there are 1440 twips to the inch
 
Thanks CJ
But it not working
why i can't understand
 
what does 'its not working' mean?

code runs, but nothing happens? you get an error? subform changes height but not by the right amount? or what?
 
i mean with not working is

Subform height ,not resize as no of records
 
better copy and paste the code you are actually using
 

Users who are viewing this thread

Back
Top Bottom