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

Determine 'Top' Value of Control 1

Status
Not open for further replies.

jkirkland

Technical User
Apr 24, 2003
61
US
I have a report with 2 subreports. The subreports are in a groupheader. I want to insert a page break in between the subreports if the second subreport happens to be more than 8 inches (11,520 twips) below the top of the paper.

I can get the distance of the group header from the top of the paper using me.Top on the OnFormat Event of the group header, but ctl.Top just gives me the control's original top value, not its top value after the subreport above it was filled with records. (The two subreports will have different numbers of records each time the report runs)

I can't find anything in the forums or the help files. Has anyone had experience with this.

Thanks!
 
The rendered Top property is only available in the On Print event. I think this may occur too late to show or hide a pagebreak control.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
You're right. I played with the OnPrint event and this does get me the rendered Top value but the OnFormat event appears to occur first which means it can't use the rendered Top value to decide whether or not to show a page break.

I was think of having the code open the report then advance through each page and write the rendered Top values to a temp table.

Do you know how to open a report and have it advance through each page so the OnPrint event occurs and sets the Top value for each of the controls? I can't figure out how to make it advance. (I've had the same problem when trying to make table of contents)

Thanks for your help.
 
I'm not aware of how to make this happen. I would suggest you search through
Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
You were correct sir. Lebans' website does have a solution for moving from page to page in a report in print preview mode. I downloaded it and it works well but is fairly elaborate.

I did find a poor man's solution though which is to use the Sendkeys "{Right}" command when the report is in print preview mode. (The report has to open in Zoom to fit view for this to work. If it is opened where the zoom is at 100% then the Sendkeys "{Right}" command merely scrolls the report to the right.)

I'm using the command in a section's OnPrint event and having it perform the command as many times as there are pages. It also right the Top values of the controls to a temp table during this event, though I'm still tweaking that part.

Thank you for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top