473,398 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

RowHeight

I'm trying to size a subform control to display all of the records (thus
eliminating the vertical scroll bar). I know that the CanGrow property is
only for printing.

My thought was to determine the number of records in the subform and the
current setting of RowHeight and use that to determine how to size the
subform control.

My problem seems to involve the RowHeight property. When I try to determine
it's current value the property returns a value of True (-1) instead of the
twips. What am I doing wrong?
Dim Mreccount As Double
Dim Msubfrmheight As Double
Dim Mrowheight As Double

Mreccount = Me.Child5.Form.RecordsetClone.RecordCount
Mrowheight = Me.Child5.Form.RowHeight ''' <--this returns true, why?
Msubfrmheight = (Mreccount + 2) * Mrowheight
Me.Child5.Height = Msubfrmheight

Thanks To All,
Fred Zuckerman

Jun 27 '08 #1
3 4640
On May 2, 10:30 am, "Fred Zuckerman" <Zuckerm...@sbcglobal.netwrote:
I'm trying to size a subform control to display all of the records (thus
eliminating the vertical scroll bar). I know that the CanGrow property is
only for printing.

My thought was to determine the number of records in the subform and the
current setting of RowHeight and use that to determine how to size the
subform control.

My problem seems to involve the RowHeight property. When I try to determine
it's current value the property returns a value of True (-1) instead of the
twips. What am I doing wrong?

Dim Mreccount As Double
Dim Msubfrmheight As Double
Dim Mrowheight As Double

Mreccount = Me.Child5.Form.RecordsetClone.RecordCount
Mrowheight = Me.Child5.Form.RowHeight ''' <--this returns true, why?
Msubfrmheight = (Mreccount + 2) * Mrowheight
Me.Child5.Height = Msubfrmheight

Thanks To All,
Fred Zuckerman
It's crazy, but it's returning -1 because it is set to the default
value of 240 twips. Why it doesn't return 240, I don't know. But if
you set it to 240 (or some other value) yourself then RowHeight will
return the value you set, e.g.

Mreccount = Me.Child5.Form.RecordsetClone.RecordCount
Me.Child5.Form.RowHeight = 240
Mrowheight = Me.Child5.Form.RowHeight ''' <--this will now return 240
Msubfrmheight = (Mreccount + 2) * Mrowheight
Me.Child5.Height = Msubfrmheight

Conversely, setting the RowHeight to -1 will restore the default value
of 240.

Bruce
Jun 27 '08 #2
Fred Zuckerman wrote:
I'm trying to size a subform control to display all of the records
(thus eliminating the vertical scroll bar). I know that the CanGrow
property is only for printing.

My thought was to determine the number of records in the subform and
the current setting of RowHeight and use that to determine how to
size the subform control.

My problem seems to involve the RowHeight property. When I try to
determine it's current value the property returns a value of True
(-1) instead of the twips. What am I doing wrong?
Dim Mreccount As Double
Dim Msubfrmheight As Double
Dim Mrowheight As Double

Mreccount = Me.Child5.Form.RecordsetClone.RecordCount
Mrowheight = Me.Child5.Form.RowHeight ''' <--this returns true, why?
Msubfrmheight = (Mreccount + 2) * Mrowheight
Me.Child5.Height = Msubfrmheight

Thanks To All,
Fred Zuckerman
According to the Help file -1 is the value that corresponds to setting the
RowHeight to its default hieght for the current font.

Instead of worrying about "getting" the RowHeight, just go ahead and set it.
It will take some trial and error, but otherwise should work.

This also only applies to datasheet view. Is that the view that your
subform uses?

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Jun 27 '08 #3
"Rick Brandt" <ri*********@hotmail.comwrote in message
news:4k****************@newssvr21.news.prodigy.net ...
Fred Zuckerman wrote:
>I'm trying to size a subform control to display all of the records
(thus eliminating the vertical scroll bar). I know that the CanGrow
property is only for printing.

My thought was to determine the number of records in the subform and
the current setting of RowHeight and use that to determine how to
size the subform control.

My problem seems to involve the RowHeight property. When I try to
determine it's current value the property returns a value of True
(-1) instead of the twips. What am I doing wrong?
Dim Mreccount As Double
Dim Msubfrmheight As Double
Dim Mrowheight As Double

Mreccount = Me.Child5.Form.RecordsetClone.RecordCount
Mrowheight = Me.Child5.Form.RowHeight ''' <--this returns true, why?
Msubfrmheight = (Mreccount + 2) * Mrowheight
Me.Child5.Height = Msubfrmheight

Thanks To All,
Fred Zuckerman

According to the Help file -1 is the value that corresponds to setting the
RowHeight to its default hieght for the current font.

Instead of worrying about "getting" the RowHeight, just go ahead and set
it. It will take some trial and error, but otherwise should work.

This also only applies to datasheet view. Is that the view that your
subform uses?

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Yes, the subform is in datasheet view.
A previous reply from Bruce told me that the default value is 240 twips. So,
like you and he recommend, I'll just set the RowHeight to 240, then the code
should work fine.
Thank You Very Much,
Fred
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Timo | last post by:
All my font-sizes are set as relative sizes in CSS (large, medium, small, x-small, etc). Let's say something is set in CSS to be xx-large, but a visually impaired user wants it displayed even...
3
by: deko | last post by:
I can set the ColumnWidth property of a datasheet in VBA like this: Forms("frm0").Controls(strForm).Form.Controls(strCtl).ColumnWidth = intCw But when I try to set the RowHeight like this: ...
0
by: Daisy | last post by:
To make my column headings looks like the listviews, I've been doing: // Draw each column title e.Graphics.FillRectangle(new SolidBrush(SystemColors.Control), XPos, 0, cColumn.Width - 1,...
3
by: Tracey | last post by:
Thank you guys. But what I meant is to automatically adjust the height of rows in datagrid regardless of font. For instance, the datasource of datagrid is attached to several datagrid rows. One...
1
by: John D Suru | last post by:
How do I disable the ability to adjust the row height in a datagrid? I don't see any property that can be set to do this John Suru
2
by: Elena | last post by:
I have code that works in VBA that I must convert to VB.Net. It works perfectly behind an Excel Form. I am writing a program in VB.Net that fills an Excel Document. I've exhausted my help in...
1
by: jediknight | last post by:
Hi All, I am very new to ASP.NET but have used c# for windows very much. I would like to display an imagemap which has the background as the map of a city centre and icons denoting important...
4
by: Vidhura | last post by:
This article explains how to make all the rows height the same in DataGridView in .Net 2.0 while using AutoSizeRowMode In DataGridView 2.0,there is a option to resize row to fit the content of...
5
by: GiftX | last post by:
Hello members, I need help with my spreadsheet display problem. I generated my spreadsheet in using vb6. Everything is working except that when I display the display (making it visible), some of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.