Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MS access

Posted on 2013-01-21
10
Medium Priority
?
278 Views
Last Modified: 2013-02-06
I want to do Running Sum in Query2 but it is not working please if someone can look at it and fix it. Attach is the database.
Thanks
test.mdb
0
Comment
Question by:snhandle
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 26

Expert Comment

by:jerryb30
ID: 38803543
Can you give example of what you want to see, based on posted data?
0
 

Author Comment

by:snhandle
ID: 38803574
EmpAlias      SumOfSumOfTotal      RunTot
01-Jul-12      6,000.00                      6000
02-Jul-12      500.00                      6500
03-Jul-12      (1,200.00)                      5,300.00
09-Jul-12      (10,927.40)             -5627.4

I want to see the query2 result like the above result if I select the date range from July 1 through July 9th.
Thanks
0
 
LVL 26

Expert Comment

by:jerryb30
ID: 38803722
Try this, one query:
SELECT a.Date AS EmAlias, Sum(nz([dr],0))-Sum(nz([cr],0)) AS SumTotal, DSum("nz([dr],0)","[base Table]","[date] <= #" & [a.date] & "#")-DSum("nz([cr],0)","[base Table]","[date] <= #" & [a.date] & "#") AS unTot
FROM [Base Table] AS a
GROUP BY a.Date;
0
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 
LVL 26

Expert Comment

by:jerryb30
ID: 38803747
For the parens:
SELECT a.Date AS EmpAlias, Format(Sum(nz([dr],0))-Sum(nz([cr],0)),"0;(0)") AS SumTotal, DSum("nz([dr],0)","[base Table]","[date] <= #" & [a.date] & "#")-DSum("nz([cr],0)","[base Table]","[date] <= #" & [a.date] & "#") AS RunTot
FROM [Base Table] AS a
GROUP BY a.Date
HAVING (((a.Date) Between [start date] And [end date]));
0
 
LVL 26

Expert Comment

by:jerryb30
ID: 38803776
See NewQuery in attached.
I removed PasteErrors table to save size.
testc.mdb
0
 
LVL 49

Expert Comment

by:Dale Fye
ID: 38803785
Can I ask why you want to do this in a query?

If you are going to use this in a report, then create an extra textbox in the report, set it's Control Source to the appropriate field, then set the Running Sum property (Data tab) to "Over all" or "Over group".
0
 

Author Comment

by:snhandle
ID: 38804161
I want to do this in query because I want to get only negative lines  in the query, and in reports if I do runningsum then if I want to show only negative lines on the report I can not do that, because then it leave blank spaces.
0
 
LVL 49

Expert Comment

by:Dale Fye
ID: 38805212
Did you try the solution I gave you to that problem.  I posted a sample database for you to look at.
0
 
LVL 31

Accepted Solution

by:
hnasr earned 2000 total points
ID: 38806496
Try this through report.
'set value to 0 if positive
add txtSumOfTotal = IIf([SumOfTotal]>0,0,[SumOfTotal])

In detail format event:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
   
    If SumOfTotal >= 0 Then
        Cancel = True
    End If
End Sub
test-Q-28003512.mdb
0
 

Author Comment

by:snhandle
ID: 38862367
good
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question