Wrox Programmer Forums Aggregate Function
 | FAQ | Members List | Search | Today's Posts | Mark Forums Read
 Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
 Welcome to the p2p.wrox.com Forums. You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersâ€™ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
December 4th, 2005, 04:16 PM
 Registered User Join Date: Dec 2005 Location: Richmond, Va, USA. Posts: 2 Thanks: 0 Thanked 0 Times in 0 Posts
Aggregate Function

What i am aattempting to do is create an aggregate function that multiplies together all of the results from a query. For example, if the query contained 1,2 and 5, the aggregate function would return 10. It would not seem to be difficult to do this, but I am a new Access user, and am having trouble with these aggregate functions. Please help me if you know how.

December 4th, 2005, 05:40 PM
 Authorized User Join Date: Nov 2003 Location: Hillsboro, Ohio, USA. Posts: 43 Thanks: 0 Thanked 0 Times in 0 Posts

Need a little more info on what your trying to accomplish. if you're wanting to multiply all the values from a query against each other, you're probably gonna have to write some sort of custom function that loops through the results.

December 4th, 2005, 08:04 PM
 Registered User Join Date: Dec 2005 Location: Richmond, Va, USA. Posts: 2 Thanks: 0 Thanked 0 Times in 0 Posts

I was thinking that was what would be necassary.

I have a table of monthly return data for an investment. What the function will do is multiply together a compound return for the period in question. If i knew the VBA for the sum function, it would be a simple matter of switching the +'s to *'s.

Below would be a specific example:

Date Return
Oct 05 1.1%
Nov 05 1.3%
Dec 05 2.5%

If I specified a three month time period through a form (i can do this part), I might get data like above. What I would wantr to see is the compound return, which would be 1.011(1+the return value)times 1.013 times 1.025, or 1.0497 as a totak number. This data item indicates a that there is a 4.97% return over that time period. Again, so easy in Excel, so hard in Access. Thanks for helping out.

December 5th, 2005, 09:24 AM
Friend of Wrox
 Points: 9,611, Level: 42
 Activity: 0%

Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts

Can you write out the formula that you would have used in Excel that you want to duplicate in Access?

Thanks,

mmcdonal

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is Off HTML code is OffTrackbacks are Off Pingbacks are On Refbacks are Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post aggregate function polofson BOOK: Professional SQL Server 2005 Reporting Services ISBN: 0-7645-8497-9 0 August 14th, 2007 01:29 PM Using AVG aggregate function with decimal elygp SQL Server 2000 2 May 7th, 2007 09:04 PM Aggregate function MAX creating problem..? Manu SQL Language 4 May 30th, 2006 04:41 AM Aggregate Function MAX, SUM Manu SQL Language 2 May 30th, 2006 04:40 AM Count aggregate function Robert_Hill BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 August 24th, 2004 01:12 PM

All times are GMT -4. The time now is 09:03 AM.