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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate No. Rows visible in a Datasheet

Status
Not open for further replies.

IanGalletly

Programmer
Jun 17, 2003
16
0
0
GB
Can anyone suggest a way to workout how many rows are displayed in a datasheet.

I thought this would be straigth forward. The reason this isn't so straight forward seems to be as follows:-

1. The datasheet may have been resized

2. RowHeight may have been changed (including set to default which means its value will be -1, the actual height will then be dependant on the current font and font size.

I'm sure there are other problems I haven't even got to yet :(

Any help would be appreciated.
 
Can you not calculate it by doing Height of subform control divided by the rowheight of the subform data? You will need to take into account any footers or headers too.

Just out of interest, why do you want to know that?

B

----------------------------------------------
Ben O'Hara

"Where are all the stupid people from...
...And how'd they get so dumb?"
NoFX-The Decline
----------------------------------------------
 
Hi Ben

I started thinking I could do it as you suggest - but the rowheight is only valid if its been set to something other than the default row height (it returns -1 then, the actual row height is then dependant on the datasheet font).

The reason I wanted this was so I could workout where the current row is in relation to the displayed records. If you use a recordsetclone and bookmarks to re-select a record after code has changed the record order (Used where you provide First, Previous, Next and Last buttons to change record order), the record often ends up as the last or first record displayed, so all the records scroll on each change. It would be nice to position the changed record in the middle of the display so the user would see it moved up or down, rather than sitting at the top or bottom of the page.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top