VB+Access仓库管理系统 第7页
VB+Access仓库管理系统 第7页
图5.2添加操作
与登录窗体相关的程序
Dim datacount As Integer '操作员个数
Private Sub cmdCancel_Click() '取消
If Login1 = 1 Then
Unload Login
Else
End
End If
operater.Recordset.Close
End Sub
Private Sub cmdDate_Click()
DTPicker1.Visible = True
End Sub
Private Sub CmdOK_Click() '登录
If txtPassword = Password And Trim(Password) <> "" Or datacount = 0 Then
If Login1 = 1 Then
Load Mainform
Else
Mainform.Show
End If
If Rights = 2 Then
Mainform.M_Setup.Visible = False
Else
Mainform.M_Setup.Visible = True
End If
Me.Hide
If Login1 = 1 Then Mainform.StatusBar1.Panels.Item(1).Text = "管理员: " & Operater1
If Rights = 1 Then
Mainform.M_ChangePassword.Visible = True
Else
Mainform.M_ChangePassword.Visible = False
End If
Else
MsgBox "输入的密码有误,请重新输入!!!!"
txtPassword.SetFocus
End If
txtPassword = ""
End Sub
Private Sub Combo1_Click() '选择操作员
If Trim(Combo1.Text) <> "" And datacount <> 0 Then
txtPassword.Enabled = True
txtPassword.SetFocus
operater.RecordSource = "select * from operater where 姓名='" & Trim(Combo1.Text) & "'"
operater.Refresh
Operater1 = operater.Recordset.Fields(0)
Password = operater.Recordset.Fields(1)
Rights = operater.Recordset.Fields(2)
End If
End Sub
Private Sub DTPicker1_Change() '改变日期
Date = DTPicker1.Value
DTPicker1.Visible = False
txtDate = Year(Date) & "年" & Month(Date) & "月" & Day(Date) & "日"
MsgBox ("日期更改成功!!!")
If Login1 = 1 Then Mainform.StatusBar1.Panels.Item(3).Text = Date
End Sub
Private Sub Form_Load() '初始化
Login.Caption = "登录"
txtDate = Year(Date) & "年" & Month(Date) & "月" & Day(Date) & "日"
DTPicker1.Value = Date
Call pd
If datacount = 0 Then
Operater1 = "无"
Combo1.Enabled = False
txtPassword.Enabled = False
cmdOK.Enabled = True
Text1.Visible = True
Else
operater.Recordset.MoveFirst
Do While operater.Recordset.EOF = False
Combo1.AddItem operater.Recordset.Fields(0)
operater.Recordset.MoveNext
Text1.Visible = False
End If
End Sub
Private Sub Text2_Change()
End Sub
Private Sub Timer1_Timer()
txtTime.Text = Time
End Sub
Private Sub pd() '判断是否存在操作员
operater.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Storehouse.mdb;Persist Security Info=False"
operater.CommandType = adCmdUnknown
operater.RecordSource = "select * from Operater"
operater.Refresh
datacount = operater.Recordset.RecordCount
End Sub
Private Sub txtPassword_Change() '判断是否输入密码
If Len(Trim(txtPassword)) = 0 Then
cmdOK.Enabled = False
Else
cmdOK.Enabled = True
End If
End Sub
Private Sub txtPassword_GotFocus()
txtPassword.BackColor = &HC0FFFF
txtPassword.SelStart = 0
txtPassword.SelLength = 12
End Sub
Private Sub txtPassword_LostFocus()
txtPassword.BackColor = &HFFC0C0
5.2.3 主界面设置
新建一个窗体,建好界面后如下图
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>