📄 按人查询.frm
字号:
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Index = 0
Left = 1800
MaxLength = 20
TabIndex = 0
Text = "Text1"
Top = 360
Width = 1095
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Index = 1
Left = 4080
MaxLength = 20
TabIndex = 1
Text = "Text1"
Top = 360
Width = 1455
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "入/领料人:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Index = 1
Left = 3000
TabIndex = 11
Top = 405
Width = 1155
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "入/领料人编号:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Index = 0
Left = 240
TabIndex = 5
Top = 405
Width = 1575
End
End
End
Attribute VB_Name = "查询方式之——按人查询"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim list1SQL As String
Dim list2SQL As String
'------------判断是否输入了编号------------
If Text1(1).Text = "" Then
MsgBox ("输入的编号有误,请重新输入!")
Text1(0).SelStart = 0
Text1(0).SelLength = Len(Text1(0))
Text1(0).SetFocus
Exit Sub
End If
list1SQL = "select * from outstorehouse where 领料人编号='" + Trim(Text1(0)) + "'"
list2SQL = "select * from instorehouse where 入料人编号='" + Trim(Text1(0)) + "'"
Call list1disp(list1SQL)
Call list2disp(list2SQL)
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Me.Top = (主界面.Height - Me.Height) / 2 - 800
Me.Left = (主界面.Width - Me.Width) / 2
Me.Caption = "仓库管理系统→" & "按人查询操作"
instorehouse.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Storehouse.mdb;Persist Security Info=False"
outstorehouse.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Storehouse.mdb;Persist Security Info=False"
person.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Storehouse.mdb;Persist Security Info=False"
Text1(0).BackColor = &HFFC0C0
Text1(1).BackColor = &HFFC0C0
Call list1disp("outstorehouse")
Call list2disp("instorehouse")
Text1(0).Text = ""
Text1(1).Text = ""
End Sub
Private Sub list2def() '将list2的表头初始化
list2.TextMatrix(0, 0) = "品名"
list2.TextMatrix(0, 1) = "规格"
list2.TextMatrix(0, 2) = "导电"
list2.TextMatrix(0, 3) = "硬度"
list2.TextMatrix(0, 4) = "数量"
list2.TextMatrix(0, 5) = "单位"
list2.TextMatrix(0, 6) = "入库日期"
list2.TextMatrix(0, 7) = "入料人编号"
list2.TextMatrix(0, 8) = "入料人"
list2.TextMatrix(0, 9) = "经手人"
list2.TextMatrix(0, 10) = "说明"
list2.TextMatrix(0, 11) = "入库标识"
End Sub
Private Sub list1def() '将list1的表头初始化
list1.TextMatrix(0, 0) = "品名"
list1.TextMatrix(0, 1) = "规格"
list1.TextMatrix(0, 2) = "导电"
list1.TextMatrix(0, 3) = "硬度"
list1.TextMatrix(0, 4) = "数量"
list1.TextMatrix(0, 5) = "单位"
list1.TextMatrix(0, 6) = "毛坯尺寸"
list1.TextMatrix(0, 7) = "毛坯数量"
list1.TextMatrix(0, 8) = "成品尺寸"
list1.TextMatrix(0, 9) = "成品数量"
list1.TextMatrix(0, 10) = "余料"
list1.TextMatrix(0, 11) = "报废"
list1.TextMatrix(0, 12) = "出库日期"
list1.TextMatrix(0, 13) = "领料人编号"
list1.TextMatrix(0, 14) = "领料人"
list1.TextMatrix(0, 15) = "经手人"
list1.TextMatrix(0, 16) = "其它用途"
list1.TextMatrix(0, 17) = "说明"
End Sub
Private Sub Text1_GotFocus(Index As Integer)
Text1(Index).BackColor = &HC0FFFF
If Index = 0 Then
Text1(1).Text = ""
End If
End Sub
Private Sub Text1_LostFocus(Index As Integer)
Text1(Index).BackColor = &HFFC0C0
If Index = 0 Then
person.RecordSource = "select * from person where 编号='" + Trim(Text1(0)) + "'"
person.Refresh
If person.Recordset.EOF = False Then
Text1(1).Text = person.Recordset.Fields(1)
End If
End If
End Sub
Private Sub list2disp(StrSQL As String)
Dim roww As Integer ''行
roww = 1
list2.Clear
list2.rows = 1
Call list2def
instorehouse.RecordSource = StrSQL
instorehouse.Refresh
If instorehouse.Recordset.EOF = False Then
instorehouse.Recordset.MoveFirst
End If
Do While instorehouse.Recordset.EOF = False
list2.rows = list2.rows + 1
list2.TextMatrix(roww, 0) = instorehouse.Recordset.Fields(0)
list2.TextMatrix(roww, 1) = instorehouse.Recordset.Fields(1)
list2.TextMatrix(roww, 2) = instorehouse.Recordset.Fields(2)
list2.TextMatrix(roww, 3) = instorehouse.Recordset.Fields(3)
list2.TextMatrix(roww, 4) = instorehouse.Recordset.Fields(4)
list2.TextMatrix(roww, 5) = instorehouse.Recordset.Fields(5)
list2.TextMatrix(roww, 6) = instorehouse.Recordset.Fields(6)
list2.TextMatrix(roww, 7) = instorehouse.Recordset.Fields(7)
list2.TextMatrix(roww, 8) = instorehouse.Recordset.Fields(8)
list2.TextMatrix(roww, 9) = instorehouse.Recordset.Fields(9)
list2.TextMatrix(roww, 10) = instorehouse.Recordset.Fields(10)
list2.TextMatrix(roww, 11) = instorehouse.Recordset.Fields(11)
roww = roww + 1
instorehouse.Recordset.MoveNext
Loop
End Sub
Private Sub list1disp(StrSQL As String)
Dim roww As Integer ''行
roww = 1
list1.Clear
list1.rows = 1
Call list1def
outstorehouse.RecordSource = StrSQL
outstorehouse.Refresh
If outstorehouse.Recordset.EOF = False Then
outstorehouse.Recordset.MoveFirst
End If
Do While outstorehouse.Recordset.EOF = False
For i = 0 To 17 '给空值赋值
If IsNull(outstorehouse.Recordset.Fields(i)) = True Then
outstorehouse.Recordset.Fields(i) = ""
End If
Next i
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)
list1.TextMatrix(roww, 11) = outstorehouse.Recordset.Fields(11)
list1.TextMatrix(roww, 12) = outstorehouse.Recordset.Fields(12)
list1.TextMatrix(roww, 13) = outstorehouse.Recordset.Fields(13)
list1.TextMatrix(roww, 14) = outstorehouse.Recordset.Fields(14)
list1.TextMatrix(roww, 15) = outstorehouse.Recordset.Fields(15)
list1.TextMatrix(roww, 16) = outstorehouse.Recordset.Fields(16)
list1.TextMatrix(roww, 17) = outstorehouse.Recordset.Fields(17)
roww = roww + 1
outstorehouse.Recordset.MoveNext
Loop
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -