这可能是一件微不足道的事情,但我真的无法让它工作,我收到一条错误消息,提示“Argument not optional”。
这是我的代码,本质上代码试图添加位于表单中的数据和一些其他数据,例如当前用户和日期。
Private Sub listResult_DblClick(Cancel As Integer)
Dim sc1 As DAO.Recordset
Set sc1 = CurrentDb.OpenRecordset.Value("Stock Conversion", dbOpenDynaset)
sc1.AddNew
sc1.Fields("[SC Date]").Value = VBA.DateTime.Date
sc1.Fields("[Created By]").Value = Application.CurrentUser
sc1.Fields("[Product Code]").Value = Me.listResult.Column(0)
sc1.Fields("[Status]").Value = "NEW"
sc1.Update
End Sub
提前致谢, 鲍勃P
最佳答案
您已将值添加到 Openrecordset。你不应该:
Set sc1 = CurrentDb.OpenRecordset("Stock Conversion", dbOpenDynaset)
关于database - 尝试将记录添加到数据表,代码不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12669293/