导入静态日期/时间输入的Access

时间:2018-04-18 16:49:30

标签: vba excel-vba ms-access access-vba excel

尝试转换这个简单的Excel宏:

Private Sub Command74_Click()
On Error Resume Next
ActiveField = Format(Date, "dd/mm/yyyy") & "  " & Format(Time, "hh:mm")
End Sub

进入Access以通过按钮使用以将静态日期和时间输入到字段中。目前这是由Excel文件中的一个按钮运行,只是想在Access中使用它,这是否可能?

1 个答案:

答案 0 :(得分:1)

Not quite sure what you mean by "field" ...

However, if a textbox named ActiveField, do this:

Me!ActiveField.Value = Format(Now, "dd/mm/yyyy hh:nn")

or simply:

Me!ActiveField.Value = Now

and apply your format to the Format property of the textbox.

The textbox can be bound to a field of the table/query, the form is bound to.

相关问题