关于VB FindFirst 的一个简单问题
Data1.Recordset.FindFirst "外卡号='" & Text1(0).Text & " '"If Data1.Recordset.NoMatch = False Then
Command2.Enabled = False
Text1(0).Enabled = False
Next i
Else
MsgBox ("账号输入错误,请重新输入")
Text1(0).Enabled = True
Text1(0).Text = ""
Command2.Enabled = True
End If
请问一下高手,为什么系统提示第一句有错误呢? --------------------编程问答-------------------- Data1.Recordset.MoveFirst '此行一定要加
Data1.Recordset.FindFirst "外卡号 =" & Chr(39) & Text1(0).Text & Chr(39)
If Not Data1.Recordset.NoMatch Then
MsgBox........
--------------------编程问答-------------------- 不是吧 我看他双引号里 的 单引号是用中文输入法的 要改成英文输入法的'' --------------------编程问答-------------------- 符号的输入在程序中是没有任何问题的 --------------------编程问答-------------------- 感觉好像是连不上数据库,就连data1.recordset.movefirst也没用。我用其他的方法是说是“该操作被关联对象取消”,高手来解答一下啊。
下面这段代码也不行(数据库应该都连好了,dataname和recordsource都设置好了)。
Private Sub Command2_Click()
Dim final As Integer, Flag As Integer
Flag = 1
Data1.Recordset.MoveLast
final = Data1.Recordset.RecordCount
Data1.Recordset.MoveFirst
For i = 1 To final
If Data1.Recordset.Fields("外卡号") = Text1(0).Text Then
Flag = 0
Exit For
Else
Data1.Recordset.MoveNext
End If
Next i
If Flag = 0 Then
Command2.Enabled = False1
Text1(0).Enabled = False
Command3.Enabled = True
For i = 0 To 2
Command1(i).Enabled = True
Next i
Else
MsgBox ("账号输入错误,请重新输入")
Text1(0).Enabled = True
Text1(0).Text = ""
Command2.Enabled = True
For i = 0 To 5
Text2(i).Text = ""
Next i
For j = 0 To 2
Text3(j).Text = ""
Next j
End If
End Sub
补充:VB , 基础类