Results 1 to 6 of 6
  1. #1
    nagiese is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2011
    Location
    Nashville, TN
    Posts
    43

    Question VBA Code To Bring back Page count from Report into Form Field


    Hi, I'm trying to automate Fax Cover Sheets that have to be printed along with reports that are generated out of a journal entry database. The issue I'm having is I don't have the foggiest idea of how to write code that will pull the number of pages that will print off for each report and put that number in the "Pages Included" field on the form. The report is based on a single table and prints separate Journal entry back up documentation off via page breaks, each of these separate sections have to be faxed in with a separate fax sheet and I want to have the database generate these fax sheets as well. I'll have drop downs for the other fields needed but I'm not sure how to have it count the number of pages based on the Journal Entry number they select in the J/E field on the fax Sheet. Anyone have any suggestions, or has anyone done anything similar?
    Thanks for all your help.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    Calculating total pages can be impossible if the page breaks are dynamic and left to Access to determine. Are any textboxes set CanGrow Yes? If you have forced page breaks, what is the determination for new page - each record, each group? Can always use a DCount to determine how many records will return for given criteria.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    nagiese is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2011
    Location
    Nashville, TN
    Posts
    43
    The page breaks are forced on each change in Company code (a grouping), so they will change for some of them. There are no text boxes set to CanGrow Yes.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    Each company code can have multiple pages and the forced page break is only when company code changes? So how could it be determined how many pages each company will have? Each page will print so many records?

    I do something like this. I have a report that is set to print same header and footer on each page and only so many records in detail and textboxes do not grow. A very structured and consistent output. Code determines how many records are retrieved which by simple division can be used to determine how many pages will generate. The report is filtered to a single project number.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    nagiese is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2011
    Location
    Nashville, TN
    Posts
    43
    Yes, each company code can have multiple pages and the forece page break in only when company code changes. Yes based on the company codes each page will have so many records based on the page margins set on the report. So company codes with 3 records will have one page while company codes with 200 records will have 4 or more pending on how many fit on a page. The Report has to have headers that match the company code for the Journal entry that is being faxed. Each Jounal Entry has to have a seperate back-up report that is why there are forced page breakes. If I have the structured report you suggest then that would inter mix the Journal Entry data and that would not work.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    This backup report is a subreport? In my situation there is no subreport. Page margins are static.

    Sorry, I see no way to do this as one report output.

    Are you printing the fax cover sheet as part of the journal entry report?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Bring back focus to a form
    By AbbHeDa in forum Programming
    Replies: 6
    Last Post: 04-28-2012, 01:50 AM
  2. Replies: 2
    Last Post: 09-16-2011, 06:11 PM
  3. how to change report code page
    By broken_ice in forum Reports
    Replies: 1
    Last Post: 06-27-2010, 02:23 AM
  4. Replies: 1
    Last Post: 05-22-2010, 08:30 PM
  5. code to print just first page of a report
    By tonyrice in forum Reports
    Replies: 1
    Last Post: 02-14-2007, 03:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums