总是提示说对象变量或with块变量未设置?为什么啊?
Private Sub Command1_Click()For j = 0 To 5
If Text1(j) = "" Then
ss = MsgBox(Label1(j).Caption & "不能为空!", vbExclamation + vbOKOnly, "警告")
Text1(j).SetFocus
Text1(j).SelStart = 0
Text1(j).SelLength = Len(Text1(j).Text)
Exit Sub
End If
Next
Dim mrc As ADODB.Recordset
rukustr = "delete * from ruku where 货物编号='" & Trim(Text1(1).Text) & "'"
Set mrc = ExecuteSQL(rukustr)
rkustr = "select * from ruku "
Set mrc = ExecuteSQL(rukustr)
If rukumodi = False Then
rukustr = "select * from ruku where 货物编号='" & Trim(Text1(1).Text) & "'"
Set mrc = ExecuteSQL(kustr)
If mrc.EOF = False Then 就是这句总是提示出错
sss = MsgBox("已经存在该卡种的设置,不能重复!", vbonly, "警告")
Text1(1).SetFocus
Text1(1).SelStart = 0
Text1(1).SelLength = Len(Text1(1).Text)
mrc.Close
Exit Sub
End If
End If
mrc.AddNew
For i = 0 To 6
If Text1(6).Text = "" Then
Text1(6).Text = "无"
End If
mrc.Fields(i) = Text1(i).Text
Next i
mrc.Update
If kumodi Then
Unload Me
Else
For j = 0 To 6
Text1(j) = ""
Next
End If
End Sub --------------------编程问答-------------------- mrc.EOF = False 逻辑量还 = 什么呀,直接 not mrc.EOF 就行了!
(忘了VB中的“非”是不是not,别弄错了就丢人了) --------------------编程问答-------------------- Set mrc = ExecuteSQL(kustr)中的kustr变量串在哪里?
--------------------编程问答-------------------- Set mrc = ExecuteSQL(kustr)中的kustr变量值在哪里赋的值? --------------------编程问答-------------------- Dim mrc As ADODB.Recordset
rukustr = "delete * from ruku where 货物编号='" & Trim(Text1(1).Text) & "'"
Set mrc = ExecuteSQL(rukustr)
rkustr = "select * from ruku "
Set mrc = ExecuteSQL(rukustr)
If rukumodi = False Then
rukustr = "select * from ruku where 货物编号='" & Trim(Text1(1).Text) & "'"
Set mrc = ExecuteSQL(kustr)
If mrc.EOF = False Then 就是这句总是提示出错
kustr是什么东西?从上面的程序就没有kustr这一个值。 --------------------编程问答-------------------- 这种情况应该是你的mrc创建失败了,它的值还是nothing.
补充:VB , 基础类