做了一款管理软件运行错误请高手帮忙修改下
Dim i As IntegerDim username As String, passwd As String
-------------------------------------------------------------------------------
Private Sub Command1_Click()
Dim flag As Integer
If Trim(Text1.Text) = "" Then
MsgBox "请输入用户名", vbExclamation, "注意"
Text1.SetFocus
Exit Sub
End If
= adCmdTable
Adodc1.RecordSource = "用户"
Adodc1.Refresh【这里提示错误】
If Adodc1.Recordset.EOF And Adodc1.Recordset.BOF Then
MsgBox "目前还没有建立用户"
Else
username = Trim(Text1.Text)
passwd = Trim(Text2.Text)
flag = 0
Adodc1.Recordset.MoveFirst
Do While Not Adodc1.Recordset.EOF
If Trim(Adodc1.Recordset.Fields("用户名")) = username And Trim(Adodc1.Recordset.Fields("密码")) = passwd Then
flag = 1
Exit Do
Else
Adodc1.Recordset.MoveNext
End If
Loop
If flag = 0 Then
i = i + 1
MsgBox "身份验证失败"
If i = 3 Then
MsgBox "登录失败次数太多,系统将自动关闭"
End
Else
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End If
Else
Form2.Show
Unload Form1
End If
End If
End Sub
Private Sub Command2_Click()
Dim flag As Integer
If Trim(Text1.Text) = "" Then
MsgBox "请输入用户名", vbExclamation, "注意"
Text1.SetFocus
Exit Sub
End If
= adCmdTable
Adodc1.RecordSource = "用户"
Adodc1.Refresh
If Adodc1.Recordset.EOF And Adodc1.Recordset.BOF Then
MsgBox "目前还没有建立用户"
Else
username = Trim(Text1.Text)
passwd = Trim(Text2.Text)
flag = 0
Adodc1.Recordset.MoveFirst
Do While Not Adodc1.Recordset.EOF
If Trim(Adodc1.Recordset.Fields("用户名")) = username And Trim(Adodc1.Recordset.Fields("密码")) = passwd Then
flag = 1
Exit Do
Else
Adodc1.Recordset.MoveNext
End If
Loop
If flag = 0 Then
i = i + 1
MsgBox "身份验证失败"
If i = 3 Then
MsgBox "登录失败次数太多,系统将自动关闭"
End
Else
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End If
Else
Form3.Show
End If
End If
End Sub
Private Sub Command3_Click()
End
End Sub