请板主帮加个密码输入正确才能登陆Frm_Main.Show窗体代码
下面代码是在Combo1里选中用户名就能登陆主窗体,请板主帮再加个必须在text1中输入正确密码才能登陆Frm_Main.Show窗体代码数据库:Data.mdb,操作员表:UserInfo,编号字段:ID,操作员名字段:MC,密码字段:密码
下面是登陆窗体代码:
Option Explicit
Private Sub Command1_Click() '登陆按钮
LoginUserId = GetStr(Combo1.Text) '获取用户ID号
LoginUserName = Mid(Combo1.Text, InStr(1, Combo1.Text, "-") + 1)
CheckQx LoginUserId
Unload Me
Frm_Main.Show
End Sub
Private Sub Form_Load()
Dim Rs As New ADODB.Recordset
Set Rs = obj_qx.GetUsers
With Combo1
.Clear
While Rs.EOF = False
.AddItem Rs.Fields(0) & "-" & Rs.Fields(1)
Rs.MoveNext
Wend
If .ListCount <> 0 Then
.ListIndex = 0
End If
End With
End Sub
下面是模块代码:
Option Explicit
Public conn As New ADODB.Connection
Public obj_qx As New ClsQx
Public LoginUserId As String
Public LoginUserName As String
Sub main()
Dim strFile As String
strFile = App.Path & "\Data.mdb"
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" & strFile & "' ;Persist Security Info=False"
Frm_Login.Show
End Sub
[ 本帖最后由 幸福xf 于 2013-5-3 09:00 编辑 ]