vb中的实时错误'3021',BOF或EOF中有一个是"真",或者当前的记录以被删除 10
之前运行都正常但是不知道改了点什么东西出错了PrivateSubCommand2_Click()DimjhAsIntegerIfText1.Text=""Thenjh=M...
之前运行都正常但是不知道改了点什么东西出错了
Private Sub Command2_Click()
Dim jh As Integer
If Text1.Text = "" Then
jh = MsgBox("请输入卡号", vbExclamation, "Eorr")
Exit Sub
End If
Dim yg As Integer
If Text2.Text = "" Then
yg = MsgBox("请输入员工工号!!", vbExclamation, "Eorr")
Exit Sub
End If
Dim sc As Integer
Dim sz As Integer
sz = Text1.Text
sc = MsgBox("要激活编号" & sz & "的卡吗?", vbOKCancel, "激活确认")
Text1.Text = ""
Text2.Text = ""
If sc = 1 Then
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim str1 As String
Dim str2 As String
Dim str3 As String
str1 = "Provider=Microsoft.Jet.OLEDB.4.0;"
str2 = "Data Source=D:\vb1\Access_db.mdb;"
str3 = "Jet OLEDB:Database Password="
conn.Open str1 & str2 & str3
strSQL = "select * from wzdz where 编号=" & Val(Text1.Text) & ""
rs.Open strSQL, conn, 3, 3
Dim jhk As String
If rs!激活信息 = ("已激活") Then
jhk = MsgBox("此卡已使用过!", vbExclamation, "Eorr")
Form1.Text1.Text = ""
Form1.Text2.Text = ""
Exit Sub
End If
If rs!编号 = Val(Text1.Text) Then
rs!激活信息 = "已激活"
rs!员工工号 = Text2.Text
rs.Update
rs.Close
conn.Close
Dim a As Integer
a = MsgBox("激活成功!", vbOKOnly, "")
Adodc1.Refresh
Else
Dim kh As Integer
kh = MsgBox("无此卡号", vbQuestion, "Eorr")
Form1.Text1.Text = ""
Form1.Text2.Text = ""
rs.Close
conn.Close
Exit Sub
End If
str1 = "Provider=Microsoft.Jet.OLEDB.4.0;"
str2 = "Data Source=D:\vb1\Access_db.mdb;"
str3 = "Jet OLEDB:Database Password="
conn.Open str1 & str2 & str3
strSQL = "select * from jhkh"
rs.Open strSQL, conn, 3, 3
rs.AddNew
rs!激活卡号 = Text1.Text
rs!员工工号 = Text2.Text
rs.Update
rs.Close
conn.Close
Dim b As Integer
b = MsgBox("添加成功", vbOKOnly, "")
Adodc1.Refresh
Form1.Text1.Text = ""
Form1.Text2.Text = ""
End If
End Sub
谢谢各位大哥大家帮帮忙查下什么地方错误了!
就是这个错误大家帮忙看看谢谢!!急。。。 展开
Private Sub Command2_Click()
Dim jh As Integer
If Text1.Text = "" Then
jh = MsgBox("请输入卡号", vbExclamation, "Eorr")
Exit Sub
End If
Dim yg As Integer
If Text2.Text = "" Then
yg = MsgBox("请输入员工工号!!", vbExclamation, "Eorr")
Exit Sub
End If
Dim sc As Integer
Dim sz As Integer
sz = Text1.Text
sc = MsgBox("要激活编号" & sz & "的卡吗?", vbOKCancel, "激活确认")
Text1.Text = ""
Text2.Text = ""
If sc = 1 Then
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim str1 As String
Dim str2 As String
Dim str3 As String
str1 = "Provider=Microsoft.Jet.OLEDB.4.0;"
str2 = "Data Source=D:\vb1\Access_db.mdb;"
str3 = "Jet OLEDB:Database Password="
conn.Open str1 & str2 & str3
strSQL = "select * from wzdz where 编号=" & Val(Text1.Text) & ""
rs.Open strSQL, conn, 3, 3
Dim jhk As String
If rs!激活信息 = ("已激活") Then
jhk = MsgBox("此卡已使用过!", vbExclamation, "Eorr")
Form1.Text1.Text = ""
Form1.Text2.Text = ""
Exit Sub
End If
If rs!编号 = Val(Text1.Text) Then
rs!激活信息 = "已激活"
rs!员工工号 = Text2.Text
rs.Update
rs.Close
conn.Close
Dim a As Integer
a = MsgBox("激活成功!", vbOKOnly, "")
Adodc1.Refresh
Else
Dim kh As Integer
kh = MsgBox("无此卡号", vbQuestion, "Eorr")
Form1.Text1.Text = ""
Form1.Text2.Text = ""
rs.Close
conn.Close
Exit Sub
End If
str1 = "Provider=Microsoft.Jet.OLEDB.4.0;"
str2 = "Data Source=D:\vb1\Access_db.mdb;"
str3 = "Jet OLEDB:Database Password="
conn.Open str1 & str2 & str3
strSQL = "select * from jhkh"
rs.Open strSQL, conn, 3, 3
rs.AddNew
rs!激活卡号 = Text1.Text
rs!员工工号 = Text2.Text
rs.Update
rs.Close
conn.Close
Dim b As Integer
b = MsgBox("添加成功", vbOKOnly, "")
Adodc1.Refresh
Form1.Text1.Text = ""
Form1.Text2.Text = ""
End If
End Sub
谢谢各位大哥大家帮帮忙查下什么地方错误了!
就是这个错误大家帮忙看看谢谢!!急。。。 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询