Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I print a daily report showing the production figures for each item. I now want to print, an accumulation of the production thus far. For example if I print todays report it should also show me total production for the month up to today. If I have to reprint a report from lastweek, I should be seeing the production for that day and the accumulative production up to that point. I have a query that runs by date which shows me the production for the day but the same production figures for that day appear in the accumulative field. It does not add the previous days production figures to the accumulative. Hope this explaination helps. Thanks

Betty,
What you explain is, I think, what is called a "running total". SQL doesn't remember values from previous records so you'll need to solve this in your report.
Open the code window for the report. There's a button for this or choose menu [Extra][Macro][Visual Basic Editor] or press Alt+F11.
In the globals section (top of code window) type:
Dim dblTotal As Double
(or another appropiate type)Select from the listbox at the top left of the window "Report". There's now code for the OnLoad event. Type inside this:
dblTotal = 0Let's assume your value field is called "MyValue" and you have placed a textbox named txtRunTotal on your report.
From the left Listbox select "Detail" and from right Listbox select "Format".
Now you have code for an event when data is formatted for printing. Here you type:
dblTotal = dblTotal + [MyValue]
txtRunTotal = dblTotalRun the report.
This should do the tric.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |