📄 frmkczb.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form frmKCZB
BorderStyle = 1 'Fixed Single
Caption = "库存总表"
ClientHeight = 4605
ClientLeft = 45
ClientTop = 435
ClientWidth = 9930
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4605
ScaleWidth = 9930
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text5
Height = 270
Left = 8880
TabIndex = 15
Top = 2400
Width = 975
End
Begin VB.TextBox Text4
Height = 270
Left = 7080
TabIndex = 13
Top = 2400
Width = 855
End
Begin VB.TextBox Text3
Height = 270
Left = 5400
TabIndex = 11
Top = 2400
Width = 1095
End
Begin VB.TextBox Text2
Height = 270
Left = 2760
TabIndex = 9
Top = 2400
Width = 1335
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 1575
Left = 0
TabIndex = 6
Top = 2880
Width = 9855
_ExtentX = 17383
_ExtentY = 2778
_Version = 393216
HeadLines = 1
RowHeight = 15
FormatLocked = -1 'True
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 7
BeginProperty Column00
DataField = "入库单编号"
Caption = "入库单编号"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = "经手人"
Caption = "经手人"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column02
DataField = "物品编号"
Caption = "物品编号"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column03
DataField = "数量"
Caption = "数量"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column04
DataField = "货物编号"
Caption = "货物编号"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column05
DataField = "入库日期"
Caption = "入库日期"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column06
DataField = "备注"
Caption = "备注"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
Alignment = 2
ColumnWidth = 1200.189
EndProperty
BeginProperty Column01
Alignment = 2
ColumnWidth = 1305.071
EndProperty
BeginProperty Column02
Alignment = 2
ColumnWidth = 1305.071
EndProperty
BeginProperty Column03
Alignment = 2
EndProperty
BeginProperty Column04
EndProperty
BeginProperty Column05
Alignment = 2
EndProperty
BeginProperty Column06
Alignment = 2
EndProperty
EndProperty
End
Begin VB.TextBox Text1
Height = 270
Left = 840
TabIndex = 5
Top = 2400
Width = 975
End
Begin VB.Frame Frame1
Height = 2175
Left = 8640
TabIndex = 1
Top = 0
Width = 1215
Begin VB.CommandButton Command3
Caption = "退 出"
Height = 375
Left = 120
TabIndex = 4
Top = 1560
Width = 975
End
Begin VB.CommandButton Command2
Caption = "保存修改"
Height = 375
Left = 120
TabIndex = 3
Top = 960
Width = 975
End
Begin VB.CommandButton Command1
Caption = "修 改"
Height = 375
Left = 120
TabIndex = 2
Top = 240
Width = 975
End
End
Begin MSComctlLib.ListView ListView1
Height = 2055
Left = 0
TabIndex = 0
ToolTipText = "双击显示详细内容"
Top = 120
Width = 8655
_ExtentX = 15266
_ExtentY = 3625
LabelWrap = -1 'True
HideSelection = -1 'True
FullRowSelect = -1 'True
GridLines = -1 'True
PictureAlignment= 4
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
NumItems = 0
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "物品编号:"
Height = 180
Left = 0
TabIndex = 7
Top = 2520
Width = 900
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "货位编号:"
Height = 180
Left = 8040
TabIndex = 14
Top = 2520
Width = 900
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "数量:"
Height = 180
Left = 6600
TabIndex = 12
Top = 2520
Width = 540
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "物品类型编号:"
Height = 180
Left = 4200
TabIndex = 10
Top = 2520
Width = 1260
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "物品名称:"
Height = 180
Left = 1920
TabIndex = 8
Top = 2520
Width = 900
End
End
Attribute VB_Name = "frmKCZB"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs1 As New ADODB.Recordset
Dim sql1 As String
Private Sub Command1_Click()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = True
Text5.Enabled = True
Command2.Enabled = True
Command1.Enabled = False
End Sub
Private Sub Command2_Click()
SQL = "select [货位编号] from [货位表] where [货位编号]='" & Trim(Text5.Text) & "' "
Set rs9 = TransactSQL(SQL)
If rs9.EOF = True Then
MsgBox "对不起,没有此货位号" & vbCrLf & "请重新输入!", vbExclamation + vbOKOnly, "警告"
Exit Sub
End If
If Text1.Text = "" Then
MsgBox "请选择要修改的记录"
Exit Sub
Else
SQL = "update [库存总表] set [数量]='" & Trim(Text4.Text) & "',[货位编号]='" & Trim(Text5.Text) & "'"
SQL = SQL & "where [物品编号]='" & Trim(Text1.Text) & "'"
Set rs = TransactSQL(SQL)
MsgBox "已经成功修改库存中的数据"
Unload Me
End If
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
Me.Top = 1500
Me.Left = 2500
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Command2.Enabled = False
Set rs = New ADODB.Recordset
SQL = "select * from 库存总表 "
Set rs = TransactSQL(SQL)
If rs.RecordCount = 0 Then
MsgBox "库存中无数据", vbInformation + vbOKOnly, ginfo
' cmdChange.Enabled = False
' cmdSave.Enabled = False
ListView1.Enabled = False
Exit Sub
Else
With ListView1
.Enabled = True
.ListItems.Clear
.ColumnHeaders.Clear
.ColumnHeaders.Add , , "序号", 1000
.ColumnHeaders.Add , , "物品编号", 1300
.ColumnHeaders.Add , , "物品名称", 1600
.ColumnHeaders.Add , , "物品类型编号", 1600
.ColumnHeaders.Add , , "数量", 1400
.ColumnHeaders.Add , , "货位编号", 1600
.View = lvwReport
For i = 2 To 6
.ColumnHeaders(i).Alignment = lvwColumnCenter
Next
End With
With ListView1
Do While Not rs.EOF
For i = 1 To rs.RecordCount
Set Lst = ListView1.ListItems.Add(, , i)
Lst.SubItems(1) = Trim(rs.Fields(0).Value)
Lst.SubItems(2) = Trim(rs.Fields(1).Value)
Lst.SubItems(3) = Trim(rs.Fields(2).Value)
Lst.SubItems(4) = Trim(rs.Fields(3).Value)
Lst.SubItems(5) = Trim(rs.Fields(4).Value)
rs.MoveNext
Next
Loop
Set Lst = Nothing
End With
End If
End Sub
Private Sub ListView1_DblClick()
Set DataGrid1.DataSource = Nothing
DataGrid1.ClearFields
DataGrid1.ClearSelCols
Text1.Text = ListView1.SelectedItem.SubItems(1)
Text2.Text = ListView1.SelectedItem.SubItems(2)
Text3.Text = ListView1.SelectedItem.SubItems(3)
Text4.Text = ListView1.SelectedItem.SubItems(4)
Text5.Text = ListView1.SelectedItem.SubItems(5)
'Dim sqlmx, s As String
'Dim rsmx As New ADODB.Recordset
'Set rsmx = New ADODB.Recordset
'sqlmx = "select * from [物品明细] where [物品编号]='" & Trim(Text1.Text) & "'"
'Set rsmx = TransactSQL(sqlmx)
' s = rsmx(1)
Set rs1 = New ADODB.Recordset
sql1 = "select * from [入库单信息] where [物品编号]='" & Trim(Text1.Text) & "'"
If rs1.State Then rs1.Close
Set rs1 = TransactSQL(sql1)
Set DataGrid1.DataSource = rs1
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii > 57 Or KeyAscii < 48 And Not KeyAscii = 8 Then
KeyAscii = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -