Running Total Dsum AND a criterion (individual company) (1 Viewer)

jbrod812

New member
Local time
Today, 20:25
Joined
Jul 9, 2013
Messages
9
I am trying to create a user-friendly database to enter invoice records (deductions and additions) for securities. I would like to be able to run queries with running totals from month to month inclusive (end total of one month = starting total of next month). I have already figured out how to create a running total; however, I have numerous "companies." Each record could be from any of 30 companies. When I add up the running total from say January 1 to February 28th, I get the additions and deductions of all the companies, not just the one I want. Inputting the companyID (example A110) in the query box only adjusts what is displayed, not the running totals that go by the total deductions from the records before that record (I assigned each record a "databaseID" because dsum does not recognize dates in the criteria box, if I want to do a running sum. I was wondering how to fix this and/or if there is a better way to organize this database.

I also was wondering if it would be possible to build forms with macros to create these queries in a user-friendly manner (so the company that I am interning for can create queries when they need them without me there).
 

rzw0wr

I will always be a newbie
Local time
Today, 15:25
Joined
Apr 1, 2012
Messages
489
I believe that if done correctly Dsum() does use date in the criteria.
They Have to have to # date# I think.
Also running totals are better done either on a form or report.

Dale
 

Mihail

Registered User.
Local time
Today, 22:25
Joined
Jan 22, 2011
Messages
2,373
Take a snapshot from yours relationships window and upload it.
 

jbrod812

New member
Local time
Today, 20:25
Joined
Jul 9, 2013
Messages
9
Ok, so now I am putting the running sum in the report. The only problem that I now face is to keep the running total of ALL of the records starting from January 1, 2013. I have a "Report Generator" form that directs a query. The report is based on that query. I need to be able to report the deductions/additions for each record and then the updated running total with the deduction/addition for each record. For example, if I select January 1st to January 31st, I will have a correct running total because my data starts January 1st. If I select February 1st through February 28th, I will have the running total of Feb 1 through Feb 28. I need the running total starting January 1st, but to display only the records for the months or whatever interval that I select. Help??
 

Attachments

  • Relationships.PNG
    Relationships.PNG
    21.4 KB · Views: 137

Mihail

Registered User.
Local time
Today, 22:25
Joined
Jan 22, 2011
Messages
2,373
Create a new text box: txtGrandTotal
In the Control Source put this:

Code:
=DSum("Deductions_Additions","Transaction","Date_Invoice_Paid >= " & StartDate & " AND Date_Invoice_Paid <= " & EndDate)
Were StartDate and EndDate should be replaced with the control names that you use in the report.
 

jbrod812

New member
Local time
Today, 20:25
Joined
Jul 9, 2013
Messages
9
Thanks, but it didn't work. What control names do you mean? The report comes from a query that is controlled by an input form. The formula did not come up with any result, just a blank box. I need to literally just start it at January 1st and end it at whatever date my cutoff is in the interval that I select [example: if I wanted February 1st to February 28th, I would want the running sum to at least cover February 28th (including all of the January values in the February running sums)].
 

Mihail

Registered User.
Local time
Today, 22:25
Joined
Jan 22, 2011
Messages
2,373
I need the running total starting January 1st, but to display only the records for the months or whatever interval that I select
How you select this dates ? I assume that you use some controls for this.
 

jbrod812

New member
Local time
Today, 20:25
Joined
Jul 9, 2013
Messages
9
I have records with dates. I have the report that is linked to a query that is controlled by a form.

On the query it says in the criteria box:
Between [Forms]![Report Generator]![Beginning_Date] And [Forms]![Report Generator]![End_Date]

On the form I state my beginning_date and my end_date as well as the company whose data I would like to view.

The running sums are to keep track of an account. I have a starting amount at the beginning of January (which I just made another record for in the Deductions_additions section, so I could avoid having another table for starting amounts). I then subtract or add every time a record is added. I would like to have the running total for each record (aka at any given time, so my firm can be alerted if an account is too low).

If I select January through March, the running sums are correct because it includes everything on the report starting from the beginning of my records, January. If I select February through March, I view and receive the running sums of the values from February through March, instead of viewing February through March with the running sums having the January figures added to it. I need the latter.

I am almost complete with the database, so I'm extremely desperate to get this correct. Thank you for your continuing assistance. It means the world.

Thanks,
J
 

Mihail

Registered User.
Local time
Today, 22:25
Joined
Jan 22, 2011
Messages
2,373
Ok.
So, you must replace my StartDate with
[Forms]![Report Generator]![Beginning_Date]

Note please that I'm not 100% sure that will work but is a simple try.
 

jbrod812

New member
Local time
Today, 20:25
Joined
Jul 9, 2013
Messages
9
It unfortunately did not work. I do not understand the correct syntax for using the dsum function. I need it to narrow it down based on the company that has been selected in the form, based on the start date of January 1st and end date of the end date selected on the form, and for it to sum as a running total with the current record included. If you could help me out with the basic syntax, I could probably fill in the rest.
 

Mihail

Registered User.
Local time
Today, 22:25
Joined
Jan 22, 2011
Messages
2,373
Just a minute. The DSum do not work ? Has an error ? Or return unexpected results ?
 

jbrod812

New member
Local time
Today, 20:25
Joined
Jul 9, 2013
Messages
9
There is nothing there. The function does not refer to what it needs to. I need to be able to input the company and end date in the form and have the dsum in the report calculate a running sum based on the beginning date (January 1st, 2013) and the end date for that specific company.
 

Mihail

Registered User.
Local time
Today, 22:25
Joined
Jan 22, 2011
Messages
2,373
Ufff. Can you upload the database ? I use Access 2007.
 

Users who are viewing this thread

Top Bottom