我正在尝试通过以下代码创建属性:
Public Sub refresh()
Dim prp As DAO.Property
Set prp = CurrentDb.CreateProperty("LastRefreshedDate", dbDate, Date)
End Sub
我在构建过程中创建了以下内容来存储LastRefreshedDate,然后通过标题标签在用户表单上显示此内容,但是,该属性未显示。
' Store refresh date
CurrentDb.Properties("LastRefreshedDate") = Date
lblRefresh.Caption = "Last Refreshed: " & Format(CurrentDb.Properties("LastRefreshedDate"), " dd mmm yyyy")
答案 0 :(得分:1)
"我忘了将财产追加到CurrentDb
。"
正确的代码:
Public Sub refresh()
Dim prp As DAO.Property
Set prp = CurrentDb.CreateProperty("LastRefreshedDate", dbDate, Date)
' property has to be appended after it is created.
Currentdb.Properties.Append prp
End Sub