Private Sub Text1_GotFocus(Index As Integer)
Text1(Index).BackColor = &HC0FFFF
End Sub
Private Sub Text1_LostFocus(Index As Integer)
Text1(Index).BackColor = &HFFC0C0
If Index = 7 Then
person.RecordSource = "select * from person where 编号 = '" + Trim(Text1(7)) + "'"
person.Refresh
If person.Recordset.EOF Then
MsgBox ("库中无此人,请重新输入编号!")
Text1(7).Text = ""
Text1(8).Text = ""
'Text1(7).SetFocus
Else
Text1(8).Text = person.Recordset.Fields(1)
End If
End If
End Sub
Private Sub list1disp()
Dim roww As Integer ''行
roww = 1
list1.Clear
list1.rows = 1
Call list1def
outstorehouse.RecordSource = "select * from outstorehouse"
outstorehouse.Refresh
If outstorehouse.Recordset.EOF = False Then
outstorehouse.Recordset.MoveFirst
End If
Do While outstorehouse.Recordset.EOF = False
list1.rows = list1.rows + 1
list1.TextMatrix(roww, 0) = outstorehouse.Recordset.Fields(0)
list1.TextMatrix(roww, 1) = outstorehouse.Recordset.Fields(1)
list1.TextMatrix(roww, 2) = outstorehouse.Recordset.Fields(2)
list1.TextMatrix(roww, 3) = outstorehouse.Recordset.Fields(3)
list1.TextMatrix(roww, 4) = outstorehouse.Recordset.Fields(4)
list1.TextMatrix(roww, 5) = outstorehouse.Recordset.Fields(5)
list1.TextMatrix(roww, 6) = outstorehouse.Recordset.Fields(6)
list1.TextMatrix(roww, 7) = outstorehouse.Recordset.Fields(7)
list1.TextMatrix(roww, 8) = outstorehouse.Recordset.Fields(8)
list1.TextMatrix(roww, 9) = outstorehouse.Recordset.Fields(9)
list1.TextMatrix(roww, 10) = outstorehouse.Recordset.Fields(10)
roww = roww + 1
outstorehouse.Recordset.MoveNext
Loop
End Sub
与该窗体相关的代码
Dim row1 As Integer '选择某条记录
Dim pd As Integer '判断是否选中某一项记录
Dim datacount As Integer '判断数据库中是否有记录
Private Sub cmdadd_Click() '添加操作员
operater.RecordSource = "select * from operater where 姓名='" & Trim(Text1(0)) & "'"
operater.Refresh
If operater.Recordset.EOF = False Then
MsgBox "该操作员已经存在!!!"
Else
If Option1(0).Value = True Then
czqx = 1
Else
czqx = 2
End If
operater.Recordset.AddNew
operater.Recordset.Fields(0) = Trim(Text1(0))
operater.Recordset.Fields(1) = Trim(Text1(1))
operater.Recordset.Fields(2) = czqx
operater.Recordset.Update
operater.Refresh
End If
List.Enabled = True
Call flash
Text1(0) = ""
Text1(1) = ""
Option1(1).Value = True
Text1(0).SetFocus
End Sub
Private Sub cmdCancel_Click() '取消
Text1(0) = ""
Text1(1) = ""
Text1(0).SetFocus
Text1(0).Locked = False
Text1(0).TabStop = True
pd = 0
cmdADD.Visible = True
cmdCancel.Enabled = False
cmdCancel.Visible = False
End Sub
Private Sub cmddel_Click() '删除操作员信息
operater.RecordSource = "select * from operater where 姓名='" & Trim(Text1(0)) & "'"
operater.Refresh
If operater.Recordset.EOF = True Then
MsgBox "没有这个操作员!!"
Text1(0).SetFocus
Else
aa = MsgBox("是否删除操作员【" & Text1(0) & "】的信息", 1 + 32)
If aa = 1 Then
operater.Recordset.Delete
operater.Recordset.Update
operater.Refresh
Call csf
Call pdd
If datacount <> 0 Then Call flash
End If
Call cmdCancel_Click
End If
End Sub
Private Sub cmdMODI_Click() '修改操作员信息
If Trim(Text1(1)) = "" Then
MsgBox "密码不能为空!!!"
Text1(1).SetFocus
Exit Sub
Else
aa = MsgBox("是否修改此操作员的信息", 1 + 32)
If aa = 1 Then
operater.RecordSource = "select * from operater where 姓名='" & Trim(Text1(0)) & "'"
operater.Refresh
operater.Recordset.Fields(1) = Text1(1)
If Option1(0).Value = True Then
operater.Recordset.Fields(2) = 1
Else
operater.Recordset.Fields(2) = 2
End If
operater.Recordset.Update
operater.Refresh
Call flash
End If
End If
Call cmdCancel_Click
End Sub
Private Sub cmdRet_Click() '返回
pd = 0
Unload frmOperater
End Sub
Private Sub Form_Load() '初始化
Me.Top = (Mainform.Height - Me.Height) / 2 - 800
Me.Left = (Mainform.Width - Me.Width) / 2
Me.Caption = "仓库管理系统→" & "操作员设置"
operater.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Storehouse.mdb;Persist Security Info=False"
Call csf
Call pdd
If datacount <> 0 Then Call flash
End Sub
Private Sub List_Click() '选中某一条记录
pd = 1
row1 = List.Row
Text1(0) = List.TextMatrix(row1, 0)
Text1(1) = ""
If List.TextMatrix(row1, 2) = 1 Then
Option1(0).Value = True
Else
Option1(1).Value = True
End If
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页