标题:登入系统打开MDI窗体
只看楼主
jxyga111
Rank: 8Rank: 8
来 自:中華人民共和國
等 级:贵宾
威 望:33
帖 子:6015
专家分:895
注 册:2008-3-21
结帖率:70%
 问题点数:0 回复次数:0 
登入系统打开MDI窗体
Dim objRs As New Recordset
Dim 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
搜索更多相关主题的帖子: MDI 
2008-06-14 08:20



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-219097-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.627152 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved