仓库管理系统源代码数据库实训 第4页
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
Loop
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
End Sub
5.2.3主界面设置
新建一个窗体,建好界面后如下图
图5.3主界面设置
与主界面窗体相关的程序
Private Sub FirstInStore_Click()
FrmInstorehouse.Show
FrmInstorehouse.Option1.Value = True
End Sub
Private Sub M_ChangePassword_Click()
ChangePassword.Show
End Sub
Private Sub M_ClearData_Click()
FrmClearData.Show
End Sub
Private Sub M_DataBackup_Click()
FrmDataBackup.Show
End Sub
Private Sub M_DataMake_Click()
FrmDataMake.Show
End Sub
Private Sub M_Exchange_Click()
Login1 = 1
Login.Caption = "交接班"
Login.Show 1
Mainform.Show
End Sub
Private Sub M_Exit_Click()
aa = MsgBox("退出前请确定数据是否保存!!", 1 + 32)
If aa = 1 Then End
End Sub
Private Sub M_FindArticle_Click()
FrmFindArticle.Show
End Sub
Private Sub M_FindDate_Click()
FrmFinddate.Show
End Sub
Private Sub M_FindPerson_Click()
FrmFindperson.Show
End Sub
Private Sub laterInstore_Click()
FrmInstorehouse.Show
FrmInstorehouse.Option2.Value = True
End Sub
Private Sub M_LendThings_Click()
FrmLendThings.Show
End Sub
Private Sub M_ManSetup_Click()
frmPerson.Show
End Sub
Private Sub M_OperaterSetup_Click()
frmOperater.Show
End Sub
Private Sub M_OutStorehouse_Click()
FrmOutstorehouse.Show
End Sub
Private Sub M_PrintDay_Click()
DataReport1.Show
End Sub
Private Sub M_Printjgj_Click()
Frmprintgz.Show