登入系统打开MDI窗体
Dim objRs As New RecordsetDim Muser, Mpassword As String
Private Sub Command1_Click()
If InStr(1, Text1.Text, "-") > 0 Then
Muser = Mid(Trim(Text1.Text), 1, (InStr(1, Trim(Text1.Text), "-") - 1))
Else
Muser = Text1.Text
End If
objRs.Requery
objRs.Find ("userid='" & Muser & "'")
If objRs.EOF = False Then
If IsNull(objRs.Fields("password")) Then
Mpassword = ""
Else
Mpassword = objRs.Fields("password")
End If
If Text2.Text = Mpassword Then
Call Text1_LostFocus
A = Text3.Text
B = Text1.Text
mdi.Show
Unload Me
Else
MsgBox "密码错误,请试!"
Text2.SetFocus
Exit Sub
End If
Else
MsgBox "用户不存在!"
Text2.Text = ""
Text3.Text = ""
Text1.SetFocus
Exit Sub
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
objRs.Open "t_aa", PobjCn, adOpenKeyset
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set objRs = Nothing
End Sub
Private Sub Text1_LostFocus()
objRs.Requery
Do While Not objRs.EOF
If objRs.Fields("userid") = Text1.Text Then
Text1.Text = Text1.Text & "-" & objRs.Fields("username")
Text3.Text = objRs.Fields("userdic")
Exit Sub
End If
objRs.MoveNext
Loop
End Sub