gpt4 book ai didi

ms-access - "operation is not allowed when the object is open"

转载 作者:行者123 更新时间:2023-12-04 18:23:22 26 4
gpt4 key购买 nike

当我尝试执行程序时,我收到一个错误,例如“对象打开时不允许操作”。我正在使用 vb 6.0 和 microsoft access 数据库。这是源代码

Private Sub cmdDelete_Click()
dtaOverhead.Recordset.Open "Delete from variable where SWACTFM= " & txtEntry(0).Text & " And SWBUDACT = " & txtEntry(1).Text & " And SWREMFM = '" & txtEntry(12).Text & "' And SWACTRAW = " & txtEntry(2).Text & " And SWBUDRAW = " & txtEntry(3).Text & " And SWREMRAW = '" & txtEntry(13).Text & "' And SWACTWHS = " & txtEntry(4).Text & " And SWBUDWHS = " & txtEntry(5).Text & " And SWREMWHS = '" & txtEntry(14).Text & "' And SWACTLAB = " & txtEntry(6).Text & " And SWBUDLAB = " & txtEntry(7).Text & " And SWREMLAB = '" & txtEntry(15).Text & "' And SWACTWORK = " & txtEntry(8).Text & " And SWBUDWORK = " & txtEntry(9).Text & " And SWREMWORK = '" & txtEntry(16).Text & "' And SWACTTOTAL = " & txtEntry(10).Text & " And SWBUDTOTAL = " & txtEntry(11).Text & " And SWREMTOTAL = '" & txtEntry(17).Text & "'"
MsgBox "Record deleted successfully !", vbInformation, "Deletion Successful"
Call Filllist
Call clearall
cmdSave.Caption = "&Save"

End Sub

最佳答案

您不能两次打开一个记录集(呃,无论如何都不会在两者之间关闭它)。

一个 DELETE通常使用 Connection.Execute 来完成或 Command.Execute ,而不是 Recordset.Open .

关于ms-access - "operation is not allowed when the object is open",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10206050/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com