VB调试中遇到“对象关闭时,不允许操作”
代码如下
Private Sub cmdRefresh_Click()
Dim obj As Object, i%
With Instrument_Store.rsStockData
If .RecordCount > 0 Then
If .Status = adRecModified Then .CancelUpdate
.Requery '刷新记录集
For i = 0 To 12 '重新执行数据绑定
Set txtStock(i).DataSource = Instrument_Store
txtStock(i).DataMember = "StockData"
Next
txtStock(0).DataField = "编号"
txtStock(1).DataField = "类型"
txtStock(2).DataField = "地址"
txtStock(3).DataField = "数量"
txtStock(4).DataField = "单位"
txtStock(5).DataField = "供应商"
txtStock(6).DataField = "经办人"
txtStock(7).DataField = "备注"
txtStock(8).DataField = "最大量"
txtStock(9).DataField = "最小量"
txtStock(10).DataField = "入库时间"
txtStock(11).DataField = "出库时间"
txtStock(12).DataField = "有效期"
End If
End With
Instrument_Store.rsStockInfo.Requery
Set dgShowInInfo.DataSource = Instrument_Store
dgShowInInfo.DataMember = "InInfo"
Set dgShowOutInfo.DataSource = Instrument_Store
dgShowOutInfo.DataMember = "OutInfo"
cmdSave.Enabled = True
picNavigation.Enabled = True
cmdMove(0) = True
End Sub
[解决办法]
Instrument_Store.rsStockData没有open
Instrument_Store.rsStockData.open '?不知道你的Instrument_Store是什么对象,是否可以这样打开
[解决办法]
你的这个Instrument_Store.rsStockData没有打开阿
打开就可以了,你不是有运行顺利的代码了么。照葫芦画瓢就成了
Instrument_Store.rsStockData连接成功了没有?