📄 入库管理窗口.frm
字号:
Top = 360
Width = 975
End
Begin VB.Label Label2
Caption = "备注"
Height = 375
Index = 13
Left = 5280
TabIndex = 31
Top = 2880
Width = 855
End
Begin VB.Label Label2
Caption = "保管人"
Height = 375
Index = 12
Left = 360
TabIndex = 26
Top = 2880
Width = 855
End
Begin VB.Label Label2
Caption = "经办人"
Height = 375
Index = 11
Left = 7200
TabIndex = 25
Top = 2280
Width = 855
End
Begin VB.Label Label2
Caption = "入库日期"
Height = 375
Index = 10
Left = 3600
TabIndex = 24
Top = 2280
Width = 855
End
Begin VB.Label Label2
Caption = "供货商"
Height = 375
Index = 9
Left = 360
TabIndex = 23
Top = 2280
Width = 855
End
Begin VB.Label Label2
Caption = "金额"
Height = 375
Index = 8
Left = 7200
TabIndex = 22
Top = 1680
Width = 855
End
Begin VB.Label Label2
Caption = "单价"
Height = 375
Index = 7
Left = 3840
TabIndex = 21
Top = 1680
Width = 855
End
Begin VB.Label Label2
Caption = "数量"
Height = 375
Index = 6
Left = 360
TabIndex = 20
Top = 1680
Width = 855
End
Begin VB.Label Label2
Caption = "计量单位"
Height = 375
Index = 5
Left = 7080
TabIndex = 19
Top = 1080
Width = 855
End
Begin VB.Label Label2
Caption = "类别"
Height = 375
Index = 4
Left = 3840
TabIndex = 18
Top = 1080
Width = 855
End
Begin VB.Label Label2
Caption = "规格型号"
Height = 375
Index = 3
Left = 240
TabIndex = 17
Top = 1080
Width = 855
End
Begin VB.Label Label2
Caption = "物资名称"
Height = 375
Index = 2
Left = 7080
TabIndex = 16
Top = 480
Width = 855
End
Begin VB.Label Label2
Caption = "物资编号"
Height = 375
Index = 1
Left = 3720
TabIndex = 15
Top = 480
Width = 855
End
Begin VB.Label Label2
Caption = "入库编号"
Height = 375
Index = 0
Left = 240
TabIndex = 13
Top = 480
Width = 855
End
End
End
Attribute VB_Name = "rkgl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public a As String
Public b As String
Private Sub Command1_Click()
Dim intCount As Integer
Dim sMsg As String
Dim MsgText As String
Dim AddMsg As Boolean
AddMsg = True
For intCount = 0 To 13 '判断文本框内容是否为空
If Trim$(Text1(intCount).Text) = "" Then
sMsg = Replace(Label2(intCount).Caption, " ", "")
sMsg = sMsg & "不能为空"
MsgBox sMsg, vbOKOnly + vbExclamation, "警告"
Text1(intCount).SetFocus
AddMsg = False
Exit For
Exit Sub
End If
Next
Dim rs As ADODB.Recordset
txtSQL = "select * from msave where rkno='" & Trim$(Text1(0).Text) & "'and rkid='" & Trim$(Text1(1).Text) & "'"
Set rs = ExecuteSQL(txtSQL, txtmsg)
If rs.EOF = False Then
sMsg = "已经存在此物资编号和入库编号的记录,请重新输入物资编号或入库编号!"
MsgBox sMsg, vbOKOnly + vbExclamation, "警告"
Text1(0).Text = ""
Text1(1).Text = ""
Text1(0).SetFocus
AddMsg = False
Exit Sub
End If
rs.Close
If AddMsg = True Then
txtSQL = "select * from msave"
Set rs = ExecuteSQL(txtSQL, txtmsg)
rs.AddNew
For intCount = 0 To 13
rs(intCount) = Text1(intCount)
Next
rs.Update
rs.Close
sMsg = "添加记录成功!是否继续添加记录 "
If MsgBox(sMsg, vbOKCancel + vbExclamation, "提示") = vbOK Then
For intCount = 0 To 13
Text1(intCount).Text = ""
Next
rkgl.ShowData
End If
End If
Set rs = Nothing
End Sub
Private Sub Form_Load()
ShowTitle
ShowData
End Sub
Private Sub ShowTitle()
Dim i As Integer
With msglist
.Cols = 15
.TextMatrix(0, 1) = "入库编号"
.TextMatrix(0, 2) = "物资编号"
.TextMatrix(0, 3) = "物资名称"
.TextMatrix(0, 4) = "规格型号"
.TextMatrix(0, 5) = "类别"
.TextMatrix(0, 6) = "计量单位"
.TextMatrix(0, 7) = "数量"
.TextMatrix(0, 8) = "单价"
.TextMatrix(0, 9) = "金额"
.TextMatrix(0, 10) = "供货商"
.TextMatrix(0, 11) = "入库日期"
.TextMatrix(0, 12) = "经办人"
.TextMatrix(0, 13) = "保管人"
.TextMatrix(0, 14) = "备注"
.FixedRows = 1
For i = 0 To 13
.ColAlignment(i) = 0
Next i
.FillStyle = flexFillRepeat
.Col = 0
.RowSel = 1
.ColSel = .Cols - 1
.CellAlignment = 4
.ColWidth(0) = 200
.ColWidth(1) = 1000
.ColWidth(2) = 1000
.ColWidth(3) = 1000
.ColWidth(4) = 1000
.ColWidth(5) = 1000
.ColWidth(6) = 1000
.ColWidth(7) = 1000
.ColWidth(8) = 1000
.ColWidth(9) = 1000
.ColWidth(10) = 1000
.ColWidth(11) = 1000
.ColWidth(12) = 1000
.ColWidth(13) = 1000
.Row = 1
End With
End Sub
Public Sub ShowData()
Dim j As Integer
Dim i As Integer
Dim rs As ADODB.Recordset
If txtSQL = "" Then
txtSQL = "select * from msave"
End If
Set rs = ExecuteSQL(txtSQL, txtmsg)
If rs.EOF = False Then
rs.MoveFirst
With msglist
.Rows = 1
Do While Not rs.EOF
.Rows = .Rows + 1
For i = 1 To rs.Fields.Count - 1
Select Case rs.Fields(i).Type
Case adDBDate
.TextMatrix(.Rows - 1, i) = Format(rs.Fields(i - 1), "yyyy-m-d")
Case Else
.TextMatrix(.Rows - 1, i) = rs.Fields(i - 1)
End Select
Next i
.TextMatrix(.Rows - 1, i) = rs.Fields(i - 1)
rs.MoveNext
Loop
End With
End If
rs.Close
End Sub
Private Sub Msglist_Click()
For i = 0 To 13
Text1(i) = msglist.TextMatrix(msglist.RowSel, i + 1)
Next i
a = Format(Text1(0), "0000")
b = Format(Text1(1), "0000")
End Sub
Private Sub Command2_Click()
Dim intCount As Integer
Dim sMsg As String
Dim MsgText As String
Dim AddMsg As Boolean
AddMsg = True
For intCount = 0 To 13
If Trim$(Text1(intCount).Text) = "" Then
sMsg = Replace(Label2(intCount).Caption, " ", "")
sMsg = sMsg & "不能为空"
MsgBox sMsg, vbOKOnly + vbExclamation, "警告"
Text1(intCount).SetFocus
AddMsg = False
Exit For
Exit Sub
End If
Next
Dim rs As ADODB.Recordset
If MsgBox("保存当前记录的变化吗 ", vbOKCancel + vbExclamation, "提示") = vbOK Then
AddMsg = True
Else
AddMsg = False
End If
If AddMsg = True Then
txtSQL = "select * from msave where rkno='" & Trim(a) & "'and rkid='" & Trim(b) & "'"
Set rs = ExecuteSQL(txtSQL, txtmsg)
For intCount = 0 To 13
rs(intCount) = Text1(intCount)
Next
rs.Update
rs.Close
a = Format(Text1(0), "0000")
b = Format(Text1(1), "0000")
sMsg = "修改记录成功!"
MsgBox sMsg, vbOKOnly + vbExclamation, "警告"
rkgl.ShowData
End If
Set rs = Nothing
End Sub
Private Sub Command3_Click()
Dim intCount As Integer
Dim sMsg As String
Dim AddMsg As Boolean
Dim rs As ADODB.Recordset
If MsgBox("删除当前记录吗 ", vbOKCancel + vbExclamation, "提示") = vbOK Then
AddMsg = True
Else
AddMsg = False
End If
If AddMsg = True Then
txtSQL = "delete * from msave where rkno='" & Trim(Text1(0).Text) & "'and rkid='" & Trim$(Text1(1).Text) & "'"
Set rs = ExecuteSQL(txtSQL, txtmsg)
sMsg = "删除记录成功!"
MsgBox sMsg, vbOKOnly + vbExclamation, "警告"
rkgl.ShowData
End If
Set rs = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -