我希望我的函数打开表,并为记录计数 1 返回 1/1/2013,为记录计数 2 返回 1/2/2013 ... 为记录计数 20 返回 1/20/2013。
到目前为止,我有以下代码,但它只返回 2013 年 1 月 2 日,并且我有 24 条记录:(我的记录数每月从 22 -30 变化)
Public Function DDate() As Date
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim icounter As Integer
Dim UpBound As Long
Set db = CurrentDb()
Set rs = db.OpenRecordset("tblDDate", dbOpenDynaset)
If Not (rst.BOF And rst.EOF) Then
rst.MoveFirst
UpBound = rs.RecordCount
Do Until rs.EOF = True
For icounter = 1 To UpBound
DDate = DateAdd("m", icounter, "1/1/2013")
rst.MoveNext
Next icounter
Loop
End If
rs.Close
db.Close
End Function