Re: Writing Custom Aggregate Functions
- From: "Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx>
- Date: Mon, 31 Mar 2008 12:54:18 +0800
Yes: you can OpenRecordset(), and loop through the records building up the output string.
Some examples:
- Return a concatenated list of sub-record values:
http://www.mvps.org/access/modules/mdl0004.htm
- ECount() - an extended DCount():
http://allenbrowne.com/ser-66.html
- EAvg() - an extended DAvg():
http://allenbrowne.com/ser-68.html
A basic recordset example:
http://allenbrowne.com/func-DAO.html#DAORecordsetExample
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Mike C" <Mike C@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E7E8583C-61A6-4055-A5DB-20B605E1F629@xxxxxxxxxxxxxxxx
Hello,
Is it possible in Access to write your own custom aggregate functions?
What I am trying to do is write a function that will take a column of state
abbreviations and output the column as a string containing the long names of
the states separated by commas. I want to be able to put the function in a
textbox in the group footer of my report using the syntax:
=GenerateStateNames([State])
This is the exact same way that Sum() would behave on a column when used in
a footer. However, I have been unable to find out a way to code the function
so that it accepts [State] as a collection of values. I am able to pass it
as string and it will return the first value in the column, but for all
intents and purposes that is completely useless.
If anyone knows how I might accomplish this, it would be a great help.
Thanks,
Mike
.
- Follow-Ups:
- Re: Writing Custom Aggregate Functions
- From: Mike C
- Re: Writing Custom Aggregate Functions
- References:
- Writing Custom Aggregate Functions
- From: Mike C
- Writing Custom Aggregate Functions
- Prev by Date: Re: Adding Totals on a report
- Next by Date: Re: Adding Totals on a report
- Previous by thread: Writing Custom Aggregate Functions
- Next by thread: Re: Writing Custom Aggregate Functions
- Index(es):
Relevant Pages
|