请问问各位老师如何将表中的字段值加到公共模块中
例如:
Function GetP(A As Date) As String
Dim Re As String
If A >= CDate("2011-10-1") And A <= CDate("2011-10-22") Then
Re = "2012_P1"
其中("2011-10-1") 为表1的字段值;("2011-10-22") 为表1的字段值
请问老师如何在模块中书写!谢谢
todaynew 老师已经解决了,代码如下:
Function GetP(A As Date) As String
Dim rst, rstItems As DAO.Recordset
Dim n As Integer
Set rstItems = CurrentDb.OpenRecordset("Calendar", dbOpenDynaset)
Dim Re As String
If A >= CDate("2011-10-1") And A <= CDate("2011-10-21") Then
Re = "2012_P1"
A = Naturally_Date
End If
yanwei82123300 发表于 2011-8-26 16:12
todaynew 老师已经解决了,代码如下:
Function GetP(A As Date) As String
Dim rst, rstItems As DAO.Re ...
更看不懂了,呵呵。
以下的函数运算结果与你的函数运算结果有什么差异来着?
Function GetP(A As Date) As String
Dim Re As String
If A >= CDate("2011-10-1") And A <= CDate("2011-10-21") Then
Re = "2012_P1"
End If
GetP = Re
End Function