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 / Modules / DAO / VBA / September 2006

Tip: Looking for answers? Try searching our database.

running sum

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
aminihojat - 27 Sep 2006 18:41 GMT
Hi; all
I have a table with four fields:
Fields:            name             month        days       monthlysalary
Records:         jack               1                   15          10000
                       jack               2                   30          
20000
                       jim                 1                    3          
10000
                       jim                 2                   30          
20000
I want to get the sum of salary for 15 days of month 1 and 30 days of month
2 for jack that results 25000 . (15/30 days*10000+30/30 days*20000)
For jim 3 days of month 1 and 30 days of month 2 that results 21000 . (3/30
days*10000+30/30 days*20000)
How can I do through VBA?
thanks for help
David F Cox - 27 Sep 2006 20:37 GMT
Why VBA when a query can do it?

SELECT Table1.empname, Sum([workdays]*[salary]/30) AS earned
FROM Table1
GROUP BY Table1.empname;

I have not put in any where clauses to restrict the months to 1 and 2

> Hi; all
> I have a table with four fields:
[quoted text clipped - 14 lines]
> How can I do through VBA?
> thanks for help
 
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.