frmLogin.frm
上传用户:xianglong
上传日期:2022-06-19
资源大小:1105k
文件大小:10k
- VERSION 5.00
- Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
- Begin VB.Form frmLogin
- Caption = "系统登录"
- ClientHeight = 5385
- ClientLeft = 4350
- ClientTop = 2850
- ClientWidth = 4545
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 5385
- ScaleWidth = 4545
- Begin MSComCtl2.MonthView MonthView
- Height = 2220
- Left = 240
- TabIndex = 14
- Top = 3000
- Width = 4095
- _ExtentX = 7223
- _ExtentY = 3916
- _Version = 393216
- ForeColor = -2147483630
- BackColor = -2147483633
- BorderStyle = 1
- Appearance = 1
- MultiSelect = -1 'True
- StartOfWeek = 25559041
- CurrentDate = 39140
- End
- Begin VB.CommandButton CmdNO
- Caption = "取消"
- Height = 375
- Left = 1920
- Style = 1 'Graphical
- TabIndex = 6
- Top = 2400
- Width = 1095
- End
- Begin VB.CommandButton CmdOK
- Caption = "确定"
- Default = -1 'True
- Height = 375
- Left = 240
- Style = 1 'Graphical
- TabIndex = 5
- Top = 2400
- Width = 975
- End
- Begin VB.TextBox txtPassword
- Appearance = 0 'Flat
- ForeColor = &H00000000&
- Height = 330
- IMEMode = 3 'DISABLE
- Left = 1200
- PasswordChar = "*"
- TabIndex = 8
- Text = "11"
- Top = 960
- Width = 1455
- End
- Begin VB.ComboBox cmbname
- Appearance = 0 'Flat
- ForeColor = &H00000000&
- Height = 288
- ItemData = "frmLogin.frx":0000
- Left = 1200
- List = "frmLogin.frx":0002
- Style = 2 'Dropdown List
- TabIndex = 7
- Top = 600
- Width = 1455
- End
- Begin VB.CheckBox chkmm
- Appearance = 0 'Flat
- Caption = "修改密码"
- ForeColor = &H00000000&
- Height = 375
- Left = 2760
- TabIndex = 4
- Top = 960
- Width = 1095
- End
- Begin VB.Data Data1
- Caption = "Data1"
- Connect = "Access"
- DatabaseName = ""
- DefaultCursorType= 0 '缺省游标
- DefaultType = 2 '使用 ODBC
- Exclusive = 0 'False
- Height = 345
- Left = 2880
- Options = 0
- ReadOnly = 0 'False
- RecordsetType = 1 'Dynaset
- RecordSource = ""
- Top = 1440
- Visible = 0 'False
- Width = 1140
- End
- Begin VB.TextBox txtNewPassword
- Appearance = 0 'Flat
- ForeColor = &H00000000&
- Height = 330
- IMEMode = 3 'DISABLE
- Left = 1200
- PasswordChar = "*"
- TabIndex = 3
- Top = 1320
- Width = 1455
- End
- Begin VB.TextBox txtConPW
- Appearance = 0 'Flat
- ForeColor = &H00000000&
- Height = 330
- IMEMode = 3 'DISABLE
- Left = 1200
- PasswordChar = "*"
- TabIndex = 2
- Top = 1800
- Width = 1455
- End
- Begin VB.TextBox txtDate
- Appearance = 0 'Flat
- ForeColor = &H00000000&
- Height = 375
- Left = 1200
- TabIndex = 1
- Top = 120
- Width = 1455
- End
- Begin VB.CommandButton Cmd
- Appearance = 0 'Flat
- Height = 615
- Left = 2760
- Picture = "frmLogin.frx":0004
- Style = 1 'Graphical
- TabIndex = 0
- Top = 0
- Width = 615
- End
- Begin VB.Label Label2
- Appearance = 0 'Flat
- BackColor = &H80000005&
- BackStyle = 0 'Transparent
- Caption = "密码:"
- ForeColor = &H00000000&
- Height = 252
- Left = 240
- TabIndex = 13
- Top = 960
- Width = 972
- End
- Begin VB.Label Label1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- BackStyle = 0 'Transparent
- Caption = "用户名:"
- ForeColor = &H00000000&
- Height = 252
- Left = 240
- TabIndex = 12
- Top = 600
- Width = 972
- End
- Begin VB.Label Label3
- Appearance = 0 'Flat
- BackColor = &H80000005&
- BackStyle = 0 'Transparent
- Caption = "日期:"
- ForeColor = &H00000000&
- Height = 252
- Left = 240
- TabIndex = 11
- Top = 120
- Width = 972
- End
- Begin VB.Label lbNpw
- Caption = "新密码:"
- ForeColor = &H00000000&
- Height = 375
- Left = 240
- TabIndex = 10
- Top = 1320
- Width = 855
- End
- Begin VB.Label lbCpw
- Caption = "确认:"
- ForeColor = &H00000000&
- Height = 252
- Left = 240
- TabIndex = 9
- Top = 1920
- Width = 972
- End
- End
- Attribute VB_Name = "frmLogin"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub chkmm_Click()
- If chkmm.Value = 1 Then
- lbNpw.Visible = True
- txtNewPassword.Visible = True
- lbCpw.Visible = True
- txtConPW.Visible = True
-
- CmdOK.Move 240, 2440
- CmdNO.Move 2760, 2440
-
- frmLogin.Height = 3210
- Else
- lbNpw.Visible = False
- txtNewPassword.Visible = False
- lbCpw.Visible = False
- txtConPW.Visible = False
-
- CmdOK.Move 240, 1440
- CmdNO.Move 2760, 1440
-
- frmLogin.Height = 2250
- End If
- End Sub
- Private Sub cmd_Click()
- MonthView.Visible = True
- End Sub
- Private Sub CmdOK_Click()
- Dim czy As String
- czy = cmbname.Text
- filename = App.Path & "dbmaterialinfo2007.mdb"
- Set dbs = OpenDatabase(filename)
- Set rec = dbs.OpenRecordset("用户信息表")
- If chkmm.Value = 1 Then
- If cmbname.Text = "" Then
- r = MsgBox("没有选择用户!", 0 + 16, "提示")
- Exit Sub
- End If
- rec.MoveFirst
-
- Do While Not rec.EOF
- If rec.Fields("name") = cmbname.Text Then
- Let mm = Trim(rec.Fields("password"))
- End If
- rec.MoveNext
- Loop
- If Trim(txtPassword.Text) = mm Then
- If txtNewPassword.Text <> txtConPW.Text Then
- r = MsgBox("新密码不一致!", 0 + 16, "提示")
- txtNewPassword.Text = ""
- txtConPW.Text = ""
- txtNewPassword.Text = ""
- Else
- rec.Index = "PrimaryKey"
- rec.Seek "=", cmbname.Text
- rec.Edit
- rec.Fields(1) = txtNewPassword.Text
- rec.Update
- r = MsgBox("密码修改成功!", 0 + 64, "提示")
- Unload Me
- frmMain.Show
- End If
- Else
- r = MsgBox("旧密码错误!", 0 + 16, "提示")
- txtPassword.Text = ""
- txtPassword.SetFocus
- Exit Sub
- End If
-
- Else
- If cmbname.Text = "" Then
- r = MsgBox("没有选择用户!", 0 + 16, "提示")
- Exit Sub
- End If
- rec.MoveFirst
- Do While Not rec.EOF
- If rec.Fields("name") = cmbname.Text Then
- Let mm = Trim(rec.Fields("password"))
- End If
- rec.MoveNext
- Loop
- If Trim(txtPassword.Text) = mm Then
- czy = cmbname.Text
- Unload Me
- frmMain.Show
- Else
- r = MsgBox("密码错误", 0 + 16, "提示")
- txtPassword.Text = ""
- txtPassword.SetFocus
- End If
- End If
- frmMain.sbrDB.Panels(1).Text = czy
- dbs.Close
- End Sub
- Private Sub CmdNO_Click()
- Unload Me
- End Sub
- Private Sub Form_Load()
- MonthView.Visible = False
- lbNpw.Visible = False
- txtNewPassword.Visible = False
- lbCpw.Visible = False
- txtConPW.Visible = False
- CmdOK.Move 240, 1440
- CmdNO.Move 2760, 1440
- frmLogin.Height = 2700
- On Error GoTo NoFind
- filename = App.Path & "dbmaterialinfo2007.mdb" '设置数据库文件路径,App.Path代表该应用程序路径
- Set dbs = OpenDatabase(filename) '打开数据库
- Set rec = dbs.OpenRecordset("用户信息表") '打开表“用户信息表”
- Do While Not rec.EOF
- cmbname.AddItem rec("name").Value
- rec.MoveNext
- Loop
- txtDate.Text = Date '显示日期
- cmbname.ListIndex = 0
- NoFind:
- If Err.Number = 3044 Then
- MsgBox "数据库文件丢失,请检查源文件!", 16, "登录"
- End
- End If
- End Sub
- Private Sub MonthView_DateClick(ByVal DateClicked As Date)
- txtDate.Text = MonthView.Value
- MonthView.Visible = False
- End Sub