以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  打印日期条件的请教  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=76995)

--  作者:douglas738888
--  发布时间:2015/11/9 15:02:00
--  打印日期条件的请教
老师,这段条件代码是EXCEL合并报表打印单日报表的   Sheet1(5,11).Value = "<记账日期 = # " & Date.Today & "#>"  \'写入打印条件
如果是按月条件选择,是否要写如下代码,还是怎么写,我写 "<记账日期 = # " & Date.Month & "#>"不是共享成员
Dim y As Integer = Date.Today.Year
Dim
m As Integer = Date.Today.Month
Dim
dt1 As New Date(y, m, 1)
Dim
dt2 As New Date(y, m, Date.DaysInMonth(y, m)) \'获取本月的最后一天
Dim
Filter As String
Filter
= "日期 >= #" & dt1 & "# And 日期 <= #" & dt2 & "#"


--  作者:大红袍
--  发布时间:2015/11/9 15:05:00
--  

Dim y As Integer = Date.Today.Year
Dim m As Integer = Date.Today.Month
Dim dt1 As New Date(y, m, 1)
Dim dt2 As New Date(y, m, Date.DaysInMonth(y, m)) \'获取本月的最后一天
Dim Filter As String
Filter = "<记账日期 >= #" & dt1 & "# And 记账日期 <= #" & dt2 & "#>"

Sheet1(5,11).Value = filter