Can anyone point me toward a resource that give examples for the construction of DCount functions plus other functions? Help is not broad enough and I don't seem to find much online speaking to this.
The Access help files seem to give a good accounting of the aggregate functions, at least the files that our IT dept has given me access to. In general the aggregate functions have the following form:
All of the parameters must be in the form of a string, either a literal or a variable or some combination thereof. If you have a specific function that you want addressed let us know.
hth
Jeff Bridgham
Purdue University
Graduate School
Data Analyst
What you're cited from help, I've found, the DCount("YourField", "YourTableorQuery", "YourCriteria")
but, as luck would have it, I need more complex functions. For instance, I have a DCount function as follows:
I need to know if I can put another condition on the end to allow the user to select date parameters for this function to run. Something like:
=DCount("[resultelisa]","Main","[resultelisa] = 'Positive' AND
[dtelisa] BETWEEN {choose beginning date} AND {choose ending date}")
I know this is all wrong, but is something like this possible? This is used as a calculated field on a report that counts all the ELISA Positive samples between two dates.
Help file states that the criteria is just a SQL where clause without the keyword Where. Yes you can continue adding more criteria to the domain aggregate function. I don't think you can have those kind of parameters. I don't know, because I really don't want to find out, cause such parameters are a real pain in the rear, cause there's no mean of validating it. Rather use form controls, then:
[tt]=DCount("[resultelisa]","Main","[resultelisa] = 'Positive' AND
[dtelisa] BETWEEN #" & format$(txtStart,"yyyy-mm-dd") & "# AND #" & format$(txtEnd,"yyyy-mm-dd") & "#")[/tt]
But wouldn't you rather consider opening a recordset in stead of using domain aggregates like this?
but I don't know if that will work in an aggregate function. You could create a query for your domain and include this parameter in the where clause of the query.
hth
Jeff Bridgham
Purdue University
Graduate School
Data Analyst
I tried basing the calculated control that contains this function on a parameter query, but I just couldn't make it work. The report itself is based on a query with some sumof controls and that seemed to complicate the issue. That's why I chose the DCount function, because I could call these totals from the main table without going through a query. At run time, the user of the report selects the inclusive dates he wants to pull data from. All other data is gotten in this manner, except for the counts from above. I found, though, if I tried to add addtional fields to the querys containing sum columns, I had problems. Make sense?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.