对象变量或with块变量未设置
调试程序时,出现“对象变量或with块变量未设置”,请问是怎么回事?以下是代码,麻烦版主了。
Private Sub cmdDelete_Click()
If frmMDI.adoGuest.Recordset.EOF <> True And frmMDI.adoGuest.Recordset.BOF <> True Then
With frmMDI.adoRoom.Recordset
If MsgBox("确认要删除当前记录吗?", vbYesNo + vbQuestion + vbDefaultButton2, "确认框") = vbYes Then
.Find "RoomNo='" & frmMDI.adoGuest.Recordset!RoomNo & "'", , adSearchForward, 1
If Not .EOF Then '有就提示,然后退出
!RoomStatus = False
End If
With frmMDI.adoGuest.Recordset
.Delete
End With
dtgGuestInfo.SetFocus
End If
End With
End If
End Sub