Run function in detail_format if total pages > 1 (1 Viewer)

PShiers

Registered User.
Local time
Yesterday, 23:32
Joined
May 2, 2009
Messages
26
Hi,

what I to be able to do as the report as it is formating:

if total number of pages is going to be > 1 then
AddressSize
endif
Function AddressSize()
Address.fontsize = 9
end function

Just kind find a way of know if the report is going to be more then one page to I can to some formating to ensure it is one page

Thanks
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 19:32
Joined
Feb 19, 2002
Messages
43,293
How many records will fit on one page? Use a dCount() to count the records returned.

Reference controls using Me.controlName
 

PShiers

Registered User.
Local time
Yesterday, 23:32
Joined
May 2, 2009
Messages
26
Thanks for the reply.
I'm printing a delivey confirmation note, so it is one record. But depending on the number of lines of the customer address, warehouse address, number lines of notes and other information, the report may spills over to a second plage.

If I know it is going to go on to another second page, I change format e.g. font size of addresses or combine 1st & 2nd lines, etc...

I can do it by knowing that total number of lines that would course it to going over to second page, the using code to see number of being use and if greater then make formating change to create space, but I was hoping that there was a way to get if a report will create two pages, then I can fomat addresses, notes, etc... to reduce space taken.

Thanks in advance
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 19:32
Joined
Feb 19, 2002
Messages
43,293
You won't know it took two pages until it does.

How about counting the characters in the the columns you will print?
 

isladogs

MVP / VIP
Local time
Today, 00:32
Joined
Jan 14, 2017
Messages
18,235
Add code to the Detail_Format event.
This forces Access to go through the entire report once, apply any code in that event and then open the report normally. It is very quick.

The same idea is used by Access to determine the total number of pages and display as e.g. Page 2 of 12.
It can also be used to show a table of contents with page numbers for each section in a report
 

Cotswold

Active member
Local time
Today, 00:32
Joined
Dec 31, 2020
Messages
528
Could you not work out what the maximum amount of information there could be? Then set up the page with fonts etc so that the it will always fit regardless? After all if everything compressed into one page is Ok for some, it must be Ok for all.

On addresses, which tend to be space wasting. I used to print them in a line. So...........
Name
Addr1
Addr2
Addr3
Addr4
Pcode

became

Name, Addr1, Addr2, Addr3, Addr4, Pcode

As there are likely to be blank lines, then use a Function/Sub that would to remove them and return a string without two or three commas.

Name, Addr1,,,Addr4, Pcode will never look good on your reports. Using this format addresses only ever used one line on-screen or in a report.
 
Last edited:

Users who are viewing this thread

Top Bottom