我使用 MS Access 作为我的数据库,使用 vb2010 作为前端。现在我没有在 date_recive 列中获得确切的日期时间值。我在 Access 表的设计视图中设置了自定义日期格式,并将默认值设置为 NOW()。保存记录但不是时间后,我在 db 中获得了正确的日期值。所以你能建议我吗?
问问题
443 次
1 回答
1
I neglected to read the part about VB 2010 this code only applies to Access VBA
If you want the save button click event to set the date time field you will need to set it with code. If your field was named dtmNow and was in the record source for this form, this code will set the field to the current date and time and save the record.
Me!dtmNow = Now()
DoCmd.RunCommand acCmdSaveRecord
There may be a problem with this approach because this code will run no matter what you are changing. This will not reflect the date and time entered but the date and time last saved.
于 2012-11-12T13:36:07.243 回答