会计舞弊及其治理探讨:在光盘运行代码。老是出现实时错误'91'对象变量或With块变量未设置,错误点在Do While Not mrc.EOF

来源:百度文库 编辑:高考问答 时间:2024/05/05 00:09:34
我用的是我用的开发语言是VB,,数据库sever2000。在系统DNS中已经测试数据成功,
在运行的模块的代码是:
Public Sub FormClose()
Unload Me
End Sub
Private Sub ShowData()

Dim j As Integer
Dim i As Integer
Dim MsgText As String

Set mrc = ExecuteSQL(txtSQL, MsgText)
With msgList
.Rows = 1

Do While Not mrc.EOF‘这个就是问题出现的地方
.Rows = .Rows + 1
For i = 1 To mrc.Fields.Count
If Not IsNull(Trim(mrc.Fields(i - 1))) Then
Select Case mrc.Fields(i - 1).Type
Case adDBDate
.TextMatrix(.Rows - 1, i) = Format(mrc.Fields(i - 1) & "", "yyyy-mm-dd")
Case Else
.TextMatrix(.Rows - 1, i) = mrc.Fields(i - 1) & ""
End Select
End If
Next i
mrc.MoveNext
Loop

End With
mrc.Close

End Sub

'显示Grid表头
Private Sub ShowTitle()
Dim i As Integer

With msgList
.Cols = 11
.TextMatrix(0, 1) = "编号"
.TextMatrix(0, 2) = "名称"
.TextMatrix(0, 3) = "单位"
.TextMatrix(0, 4) = "类别"
.TextMatrix(0, 5) = "入库价格"
.TextMatrix(0, 6) = "分销价格"
.TextMatrix(0, 7) = "零售价格"
.TextMatrix(0, 8) = "生产厂家"
.TextMatrix(0, 9) = "设置日期"
.TextMatrix(0, 10) = "备注信息"

'固定表头
.FixedRows = 1

'设置各列的对齐方式
For i = 0 To 10
.ColAlignment(i) = 0
Next i

'表头项居中
.FillStyle = flexFillRepeat
.Col = 0
.Row = 0
.RowSel = 1
.ColSel = .Cols - 1
.CellAlignment = 4

'设置单元大小
.ColWidth(0) = 1000
.ColWidth(1) = 1000
.ColWidth(2) = 2000
.ColWidth(3) = 1000
.ColWidth(4) = 1000
.ColWidth(5) = 1000
.ColWidth(6) = 1000
.ColWidth(7) = 1000
.ColWidth(8) = 1000
.ColWidth(9) = 1000
.ColWidth(10) = 1000
.Row = 1

End With
End Sub

Private Sub msgList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
'右键弹出
If Button = 2 And Shift = 0 Then

End If

End Sub
望各位给我这个新手帮忙。谢谢