Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / March 2005

Tip: Looking for answers? Try searching our database.

On printing figures double

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John H W - 30 Mar 2005 22:21 GMT
When I run a report, I needed two separate counts on the same data field (P
or T). Since I could not figure out how else to do it, I wrote a function to
which you send (and return) the "P" or "F". This function just adds one to
the applicable global variable. In the reports footer, I have another
function to which you send either the P or F and it returns the amount in the
global variable.

This works find and the correct amount is displayed on screen, but when you
print the report, the figure on the report is doubled (other printings it may
be tripled, etc., depending on how many times I print the report after
running the initial report).

I have put breakpoints in the functions that adds to the count and returns
the count, but neither is activated when the report is printing.

Any ideas??

John H W
Duane Hookom - 30 Mar 2005 23:28 GMT
There is probably an easier method if we knew where you are and what your
requirements are. It is very rare that you need to write code in a report to
"tally" any values.

Signature

Duane Hookom
MS Access MVP
--

> When I run a report, I needed two separate counts on the same data field
> (P
[quoted text clipped - 19 lines]
>
> John H W
John H W - 31 Mar 2005 06:29 GMT
Actually, it is a little more complicated than below.  I have to "count" the
"F" and "P" and at the same time get 2 averages of another (currency) field,
based on the "F" and "P".  The sum of the other values are divided by the
count to get that average.

I have tried using one and two other queries, but there were just too many
variables (such as the record had to be between a set of dates).

What I need to figure out is WHY when I print what is showing on the screen
(which is correct), the count in the two (four) fields are added to the
previous amount in that field.  

Hope this helps.
John H W

> There is probably an easier method if we knew where you are and what your
> requirements are. It is very rare that you need to write code in a report to
[quoted text clipped - 23 lines]
> >
> > John H W
Duane Hookom - 31 Mar 2005 06:39 GMT
The format event of a section of a report may fire twice for each printing
of the section.

I still think there might be an easier method that doesn't involve any other
queries or code.
To count the number of "F" values in FieldA, use:
=Sum(Abs([FieldA]="F"))
to average all the FieldCurrency values where FieldA = "F"
=Sum(Abs([FieldA]="F") * FieldCurrency)/Sum(Abs([FieldA]="F"))
You may need to catch for a divide by zero if there are no "F" values in
FieldA.
Signature

Duane Hookom
MS Access MVP

> Actually, it is a little more complicated than below.  I have to "count"
> the
[quoted text clipped - 48 lines]
>> >
>> > John H W
John H W - 31 Mar 2005 22:29 GMT
The below worked.  I had forgotten that ABS would return a 1 when true.

Thanks,
John H W

> The format event of a section of a report may fire twice for each printing
> of the section.
[quoted text clipped - 59 lines]
> >> >
> >> > John H W
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.