A.D.Tejpal
adtp at touchtelindia.net
Fri Apr 15 07:36:06 CDT 2005
Rocky, You don't have to print the report twice. On clicking the command button, the sequence of commands given below, should get you the desired results. Best wishes, A.D.Tejpal -------------- Code in click event of command button ================================== DoCmd.OpenReport RepName, acViewPreview DoCmd.RunCommand acCmdFitToWindow ' Allow time to stabilise P_WaitShort 300 ' Navigate to last page (in print preview) SendKeys "^{DOWN}", True DoCmd.PrintOut ' (A) ' DoCmd.RunCommand acCmdPrint ' (B) ' Note - For direct print, use (A). Otherwise, ' (B) for invoking the Print dialog box ================================== Subroutine for time delay ================================== Sub P_WaitShort(ByVal Tmr As Long) Dim Cnt As Long For Cnt = 1 To Tmr DoEvents Next End Sub ================================== ----- Original Message ----- From: Rocky Smolin - Beach Access Software To: Access Developers discussion and problem solving Sent: Wednesday, April 13, 2005 23:50 Subject: Re: [AccessD] Page numbers for table of contents in an access report Jim: Thank you. That looks promising. However, it says: " When you preview the report, page through all of the pages of the report to make sure that the Print event is triggered for all records. " which is not practical. That's OK if I'm running it myself but not for an end user. And I don't want to print it twice. The page number is tracked in a counter that gets incremented in the page footer event. So until the report is printed once there's no way to know what page a given record is on. Is there a way to print without actually printing? Thanks and regards, Rocky Smolin Beach Access Software http://www.e-z-mrp.com 858-259-4334 ----- Original Message ----- From: "Jim Dettman" <jimdettman at earthlink.net> To: "Access Developers discussion and problem solving" <accessd at databaseadvisors.com> Sent: Wednesday, April 13, 2005 11:06 AM Subject: RE: [AccessD] Page numbers for table of contents in an access report > Rocky, > > You need to force 2 pass mode, then save the descriptions and pages to a > table on the first pass. See the following MSKB article: > > ACC2000: How to Create a Table of Contents or Index for a Report > http://support.microsoft.com/?kbid=210269 > > Jim. > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Rocky Smolin - > Beach Access Software > Sent: Wednesday, April 13, 2005 1:55 PM > To: AccessD at databaseadvisors.com > Subject: [AccessD] Page numbers for table of contents in an access > report > > > Dear List: > > I would like to insert a table of contents into a rather lengthy report > which can vary in its content. > > The content is actually printed in two subreports. > > Is there some way to know what page a detail record is on so that a table > of > contents could be generated and inserted into a report. > > MTIA > > Rocky Smolin > Beach Access Software > http://www.e-z-mrp.com > 858-259-4334