我正在使用 Microsoft Access 2007。运行下面的子程序后,我收到以下错误消息:“关闭对象时不允许操作” 尽管有此错误消息,记录仍插入到相应的表中。有人可以解释可能导致此错误的原因吗?
Private Sub Save_Click()
Dim rs As ADODB.Recordset
Dim SQL As String
On Error GoTo HandleError
Set rs = New ADODB.Recordset
SQL = "INSERT INTO [Hiring Entity] ([Hiring Entity]) VALUES (""RICH PC2"");"
rs.Open SQL, CurrentProject.Connection, _
adOpenDynamic, adLockOptimistic
With rs
.AddNew
End With
Set rs = Nothing
rs.Close
ExitHere:
Exit Sub
HandleError:
MsgBox Err.Description
Resume ExitHere
End Sub