按用户选择的日期过滤

时间:2015-05-06 15:58:08

标签: sql ms-access ms-access-2010

我正在尝试基于表格在MS Access中创建报表,其中一个表格中有一列充满了日期。我正在进行查询以生成报告,但它仅显示用户想要查看的月份和年份。它看起来像这样。它目前显示当前月份和年份的数据,但我希望此用途可选。

SELECT o.OwnerNo, o.OwnerTitle, o.OwnerInitials, o.OwnerSurname, p.PropertyNo, p.HouseNo, p.Road, p.Postcode, t.TransactionDate, t.TransactionType, t.TransactionAmount
FROM Owners AS o, Properties AS p, Transactions AS t
WHERE (((o.OwnerNo)=[p].[OwnerNo] And (o.OwnerNo)=[Please enter the Owner Number]) AND ((t.PropertyNo)=[p].[PropertyNo]))
AND ((Month([t].[TransactionDate]))=Month([Date]))
AND ((Year([t].[TransactionDate]))=Year(now))
ORDER BY t.TransactionDate DESC;

1 个答案:

答案 0 :(得分:0)

尝试将clean <- function(x) ifelse(x == "?", 0, x) data.frame(apply(df1, 2, clean)) 替换为Month([Date])[Enter the month number here]Year(now)

。{
相关问题