问题描述
我有一个表(客户),其中包含一个包含"来源"信息的字段。 我试图在用户定义的时间范围内计算该字段的出现次数。 我已整理了以下内容:
这给了我们按来源分组的整个表格;计算出现次数;合并价格....
$
SELECT Customers.Source,Count(Customers.CustDate)AS CountCustDate,Sum(Customers.ContractPrice)AS SumContractPrice
FROM Customers
GROUP BY Customers.Source
ORDER BY Customers.Source;
我把它放在一起以便允许在用户定义的日期范围内抓取信息:
SELECT DCount(" Customers.Source" =" Call / Walk In"," Customers"," Source Between#"& [输入开始日期]&"#和#"& [输入结束日期]&"#")AS CallWalkIn;
.. 。然而,当它应该是"5"时,这将返回"0"。
b
$
...这也将用于计算其他几个值。
正如你所看到的,我也想要总结'contractprice'值。
I have a table (Customers) with a field that holds 'Source' information. I am trying to count the number of occurances of this field within a user defined time frame. I have put together the following:
This gives us the whole table grouped by Source; Counting the occurances; and summing the contract price....
SELECT Customers.Source, Count(Customers.CustDate) AS CountCustDate, Sum(Customers.ContractPrice) AS SumContractPrice
FROM Customers
GROUP BY Customers.Source
ORDER BY Customers.Source;
I have put this together to allow for grabbing the information within a user defined date range:
SELECT DCount("Customers.Source" = "Call/Walk In","Customers","Source Between #" & [Enter Start Date] & "# And #" & [Enter End Date] & "#") AS CallWalkIn;
...however, this returns a "0", when it should be "5".
...this will also be used to count for several other values.
As you can see, I will also be wanting to sum the 'contractprice' values.
我也试过这个,但它没有用....
I tried this too, but it did not work....
我知道我很接近,但等于捕获的字段值的等式让我陷入困境......想法?
I know I am close, but the equation to equal the captured field values is keeping me at bay....thoughts?
谢谢你,Mayhem65
Thank you, Mayhem65
推荐答案
如果您打算在表单上显示此内容,我建议您避免使用参数查询。
If you're planning to display this on a form, I would probably suggest to avoid using a parameter query.
因此,如果您的第一个查询返回表中的所有记录,那么你的DCount()或DSum()表达式可以计算出给定日期范围内的总数而没有任何问题。
So, if your first query returns all the records from the table, then your DCount() or DSum() expression can calculated the totals within a given date range without any problems.
例如,要计算原始查询中的Source,你可以尝试例如:
For example, to count the Source from your original query, you could try something like:
= DCount(" *"," QueryName"," Source ='Call / Walk In'AND CustDate between& [StartDate]& amp; ;"#和#"& [EndDate]&"#")
=DCount("*", "QueryName", "Source='Call/Walk In' AND CustDate Between #" & [StartDate] & "# And #" & [EndDate] & "#")
希望有帮助......
Hope it helps...
这篇关于计算源信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!