If Not mrc.EOF Then问题 提示实时错误'91',对象变量或with块变量未设置 调试在If mrc.EOF = False Then中
OptionExplicitDimMyconAsNewADODB.ConnectionDimmyRsAsNewADODB.RecordsetPrivateSubComma...
Option Explicit
Dim Mycon As New ADODB.Connection
Dim myRs As New ADODB.Recordset
Private Sub Command2_Click()
Dim mrc As ADODB.Recordset
Dim txtsql As String
If Not IsNumeric(Me.Text1) Then
MsgBox "卡号请输入0001-9999的范围!", vbOKOnly + vbExclamation, "警告!"
Me.Text1.SetFocus
Exit Sub
End If
txtsql = "select * from UserDate where 卡号='" & Trim(Me.Text1) & " '"
Set mrc = TransactSQL(txtsql)
If mrc.EOF = False Then
MsgBox "已经有相同卡号!", vbExclamation + vbOKOnly, "提示"
Me.Text1.SetFocus
Me.Text1.SelStart = 0
Me.Text1.SelLength = Len(Me.Text1)
Exit Sub
End If
txtsql = "select * from UserDate"
Set mrc = TransactSQL(txtsql)
mrc.AddNew
mrc.Fields(1) = Trim(Me.Text1)
mrc.Fields(4) = Trim(Me.Text5)
mrc.Fields(5) = Trim(Me.Text4)
mrc.Fields(10) = Trim(Me.Text6)
mrc.Fields(7) = Trim(Me.Text7)
mrc.Update
End Sub 展开
Dim Mycon As New ADODB.Connection
Dim myRs As New ADODB.Recordset
Private Sub Command2_Click()
Dim mrc As ADODB.Recordset
Dim txtsql As String
If Not IsNumeric(Me.Text1) Then
MsgBox "卡号请输入0001-9999的范围!", vbOKOnly + vbExclamation, "警告!"
Me.Text1.SetFocus
Exit Sub
End If
txtsql = "select * from UserDate where 卡号='" & Trim(Me.Text1) & " '"
Set mrc = TransactSQL(txtsql)
If mrc.EOF = False Then
MsgBox "已经有相同卡号!", vbExclamation + vbOKOnly, "提示"
Me.Text1.SetFocus
Me.Text1.SelStart = 0
Me.Text1.SelLength = Len(Me.Text1)
Exit Sub
End If
txtsql = "select * from UserDate"
Set mrc = TransactSQL(txtsql)
mrc.AddNew
mrc.Fields(1) = Trim(Me.Text1)
mrc.Fields(4) = Trim(Me.Text5)
mrc.Fields(5) = Trim(Me.Text4)
mrc.Fields(10) = Trim(Me.Text6)
mrc.Fields(7) = Trim(Me.Text7)
mrc.Update
End Sub 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询