|
简 发表于 2012-2-2 07:29 ![]()
我的发货日期是日期型数据,在查询中将发货年月取值为Format([发货日期],"yy-mm") ,然后我就想查询12年1月 ...
在主窗体上建两个组合框控件,其一名曰:年度(数据源为:2010;2011;2012;2013;2014;2015,默认值为year(Date()));其二名曰:月度(数据源为1;2;3;4;5;6;7;8;9;10;11;12,默认值为month(Date()))。
筛选代码片段写:
dim strwh as string
strwh="True"
if isnull(me.年.value)=false then
strwh=strwh & " and year(发货日期)=" & me.年.value
if isnull(me.月.value)=false then
strwh=strwh & " and month(发货日期)=" & me.月.value
end if
end if
me.子窗体.form.filter=strwh
me.子窗体.form.filteron=true
同理,季度或者周的查询可比照办理。 |
|