以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- find (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=129916) |
-- 作者:lfz123 -- 发布时间:2019/1/8 18:07:00 -- find 我想写一段代码找到上一个月的余额行,并取值,比如,我的会计报表是2018年2月,我的期初余额就是2018年1月,我的报表是2018年1月,期初余额就是2017年12月,年份和月份都是string Dim cb As WinForm.ComboBox = Forms("会计科目主窗口").Controls("ComboBox2") If cb.Value IsNot Nothing Then Dim y As String = cb.Value.SubString(0,4) Dim m As String = cb.Value.SubString(5) m = m.TrimEnd("月") Dim dr3 As DataRow = DataTables("科目汇总").Find("一级码 = \'1001\' and 年份 = \'"& y-1 & "\'and 月份 = \'"& m-1 & "\'") |
-- 作者:有点蓝 -- 发布时间:2019/1/8 20:03:00 -- Dim cb As WinForm.ComboBox = Forms("会计科目主窗口").Controls("ComboBox2") If cb.Text > "" Then Dim d As Date = cdate(cb.Text.Replace("年","-").Replace("月","-") & "01") d = d.AddMonths(-1) Dim dr3 As DataRow = DataTables("科目汇总").Find("一级码 = \'1001\' and 年份 = \'" & d.Year & "\'and 月份 = \'" & d.Month & "\'") End If
|