多谢版主,这段好了,还有一段出现错误,帮我看看
Private Sub cmdenter_click()
Dim strpassword, strusername As String
Dim flag As Integer
Dim record As ADODB.Recordset
flag = 0
openrecord "select * from 用户表", record
Do Until record.EOF
strusername = record("用户名")
strpassword = record("密码")
If UCase(Me.txtusername.Value) <> UCase(strusername) Then
record.MoveNext
Else
flag = 1
Exit Do
End If
Loop
If flag = 0 Then
MsgBox "该用户名不存在,请重新输入"
Me.txtpassword.Value = ""
Me.txtusername.Value = ""
Me.txtusername.SetFocus
cmdenter.Enabled = False
Exit Sub
Else
If UCase(Me.txtpassword.Value) <> UCase(strpassword) Then
MsgBox ("密码错误,请重新输入")
Me.txtpassword.Value = "'"
Me.txtpassword.SetFocus
Exit Sub
End If
End If
DoCmd.Close
DoCmd.OpenForm "主窗体"
End Sub
运行时显示红色标注的地方出现错误