Private Sub Form_Open(Cancel as Integer)
Dim rsnb As ADODB.Recordset
Set rsnb = New ADODB.Recordset
rsnb.Open "SELECT * FROM QmessagesNoBill WHERE messageID='" & Me.OpenArgs & "'", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
Set Me.Recordset = rsnb 'set the forms recordset (me!) as the ADO recordset noted in SQL query above, see kb281998
rsnb.Close: Set rsnb = Nothing
End Sub
对错误进行调试时,突出显示按钮事件中的第一行文本:
Private Sub btnapprove_Click()
Me.Recordset!reviewed = 1 'mark that its been reviewed
Me.Recordset.Update
End Sub
请注意:
答案 0 :(得分:1)
我认为您不应该在将记录集绑定到表单后立即关闭记录集。
尝试从代码中删除rsnb.Close
,看看是否可以修复它。