Computing.Net > Forums > Database > Access 2000 query

Access 2000 query

Reply to Message Icon

Original Message
Name: Betty Mc Kenzie
Date: June 28, 2007 at 08:28:04 Pacific
Subject: Access 2000 query
OS: Win XP
CPU/Ram: 2 gig
Model/Manufacturer: Dell
Comment:

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


Report Offensive Message For Removal


Response Number 1
Name: pingy
Date: July 3, 2007 at 14:51:51 Pacific
Reply: (edit)

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 = 0

Let'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 = dblTotal

Run the report.
This should do the tric.


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Access 2000 query

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 6 Days.
Discuss in The Lounge