Office中国论坛/Access中国论坛

标题: 求助于如何将公历日期转为农历日期 [打印本页]

作者: tudozero    时间: 2019-2-28 09:43
标题: 求助于如何将公历日期转为农历日期
如下图,请问如何使用查询,将公历日期批量转化为农历日期。[attach]63255[/attach]

感谢您的支持和帮助!


作者: admin    时间: 2019-2-28 10:18
论坛有示例哦
http://www.office-cn.net/thread-98119-1-1.html
作者: tudozero    时间: 2019-2-28 10:47
感谢,但您发的这个是窗体,不是查询语句可用.
我研究下,谢谢!
作者: tudozero    时间: 2019-2-28 11:37
好难啊,这个例子不能直接用在查询上
作者: roych    时间: 2019-3-1 09:26
tudozero 发表于 2019-2-28 11:37
好难啊,这个例子不能直接用在查询上

不难啊。创建一个模块调用就好了。
  1. Function getLunar(ByVal inDate As Date)
  2.     Dim cCal As New ChineseCalendar
  3.     Dim strLunar As String
  4.     cCal.GetDate Year(inDate), Month(inDate), Day(inDate)
  5.     strLunar = cCal.LunarLongDate
  6.     If Len(cCal.SolarTerm) > 0 Then
  7.         strLunar = strLunar & "," & cCal.SolarTerm
  8.     End If
  9.     If Len(cCal.LunarHoliday) > 0 Then
  10.         strLunar = strLunar & "," & cCal.LunarHoliday
  11.     End If
  12.     Set cCal = Nothing
  13.     getLunar = strLunar
  14. End Function
复制代码
[attach]63256[/attach]

作者: tudozero    时间: 2019-3-6 10:39
太好了,非常感谢roych老师的无私帮助,感恩!




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3