以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  关于月份计算的问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=129180)

--  作者:alonemonster
--  发布时间:2018/12/23 15:05:00
--  关于月份计算的问题
 仓库报表的日期是从26日至下月26日,
For Each dr As DataRow In DataTables("设备使用情况统计表").Select("[设备名称] <>  \'nothing\'")
    dr("起日期") = e.DataRow("月") -1 & "月26日"
Next
请问如果当月是1月,这个公式就用不成了,1-1=0,怎样添加一个判断语句,当“e.DataRow("月") -1 =0”时,dr("起日期") = e.DataRow("月") +11 & "月26日"


--  作者:有点甜
--  发布时间:2018/12/23 15:51:00
--  

For Each dr As DataRow In DataTables("设备使用情况统计表").Select("[设备名称] <>  \'nothing\'")

    If e.DataRow("月") = 1 then

        dr("起日期") = "12月26日"

    else
        dr("起日期") = e.DataRow("月") -1 & "月26日"

    End If
Next