📄 frmaddgoods.frm
字号:
VERSION 5.00
Begin VB.Form frmAddGoods
AutoRedraw = -1 'True
BorderStyle = 1 'Fixed Single
Caption = "添加商品入库"
ClientHeight = 6225
ClientLeft = 45
ClientTop = 330
ClientWidth = 7185
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 6225
ScaleWidth = 7185
Begin VB.Frame fraaddfc
Caption = "添加厂商"
Height = 2535
Left = 120
TabIndex = 26
Top = 3480
Width = 6855
Begin VB.CommandButton cmdResetfc
Caption = "清空重填"
Height = 375
Left = 3960
TabIndex = 36
Top = 1920
Width = 1215
End
Begin VB.CommandButton cmdaddfc
Caption = "添加厂商"
Height = 375
Left = 1440
TabIndex = 35
Top = 1920
Width = 1215
End
Begin VB.TextBox txtAddress
Height = 375
Left = 1440
TabIndex = 34
Top = 1440
Width = 4935
End
Begin VB.TextBox txtCorporation
Height = 375
Left = 1440
TabIndex = 30
Top = 960
Width = 1935
End
Begin VB.TextBox txtPhone
Height = 375
Left = 4560
TabIndex = 32
Top = 960
Width = 1815
End
Begin VB.TextBox txtManufacturer
Height = 405
Left = 1440
TabIndex = 28
Top = 360
Width = 4935
End
Begin VB.Label lbladdress
Caption = "厂商地址:"
Height = 255
Left = 360
TabIndex = 33
Top = 1440
Width = 975
End
Begin VB.Label lblperson
Caption = "法人代表:"
Height = 255
Left = 360
TabIndex = 29
Top = 960
Width = 975
End
Begin VB.Label lbltel
Caption = "电话:"
Height = 255
Left = 3720
TabIndex = 31
Top = 960
Width = 735
End
Begin VB.Label lblfc
Caption = "厂商名称:"
Height = 255
Left = 360
TabIndex = 27
Top = 480
Width = 975
End
End
Begin VB.Frame fraaddgoods
Caption = "添加商品"
Height = 3255
Left = 120
TabIndex = 0
Top = 120
Width = 6855
Begin VB.CommandButton cmdReset
Caption = "清空重填"
Height = 375
Left = 3960
TabIndex = 25
Top = 2760
Width = 1215
End
Begin VB.TextBox txtGoodsNo
Height = 375
Left = 1680
TabIndex = 2
Text = "编号自动添加"
Top = 240
Width = 1455
End
Begin VB.TextBox txtName
Height = 375
Left = 4680
TabIndex = 4
Top = 240
Width = 1575
End
Begin VB.TextBox txtFc
Height = 375
Left = 1680
TabIndex = 6
Top = 720
Width = 1455
End
Begin VB.TextBox txtType
Height = 375
Left = 4680
TabIndex = 8
Top = 720
Width = 1575
End
Begin VB.TextBox txtPrice
Height = 375
Left = 1680
TabIndex = 10
Top = 1200
Width = 1455
End
Begin VB.TextBox txtQuantity
Height = 375
Left = 4680
TabIndex = 12
Top = 1200
Width = 1575
End
Begin VB.TextBox txtyear
Height = 375
Left = 1680
TabIndex = 14
Top = 1680
Width = 615
End
Begin VB.CommandButton cmdAdd
Caption = "添加入库"
Height = 375
Left = 1560
TabIndex = 24
Top = 2760
Width = 1215
End
Begin VB.TextBox txtem
Height = 375
Left = 1680
TabIndex = 21
Top = 2280
Width = 1215
End
Begin VB.TextBox txtmon
Height = 375
Left = 2760
TabIndex = 16
Top = 1680
Width = 615
End
Begin VB.TextBox txtday
Height = 375
Left = 4080
TabIndex = 18
Top = 1680
Width = 615
End
Begin VB.TextBox txtmoney
Height = 375
Left = 4680
TabIndex = 23
Top = 2280
Width = 1575
End
Begin VB.Label lblgoodsno
Caption = "商品编号:"
Height = 375
Left = 600
TabIndex = 1
Top = 240
Width = 975
End
Begin VB.Label lblgoodsname
Caption = "商品名称:"
Height = 375
Left = 3600
TabIndex = 3
Top = 360
Width = 975
End
Begin VB.Label lblfcname
Caption = "生产厂商:"
Height = 375
Left = 600
TabIndex = 5
Top = 840
Width = 975
End
Begin VB.Label lbltype
Caption = "型号:"
Height = 255
Left = 3600
TabIndex = 7
Top = 840
Width = 855
End
Begin VB.Label lblprice
Caption = "单价:"
Height = 375
Left = 600
TabIndex = 9
Top = 1200
Width = 975
End
Begin VB.Label lblquantity
Caption = "数量:"
Height = 255
Left = 3600
TabIndex = 11
Top = 1200
Width = 975
End
Begin VB.Label lblbuytime
Caption = "进货日期:"
Height = 375
Left = 600
TabIndex = 13
Top = 1680
Width = 975
End
Begin VB.Label lblem
Caption = "业务员编号:"
Height = 375
Left = 600
TabIndex = 20
Top = 2280
Width = 1215
End
Begin VB.Label Label1
Caption = "年"
Height = 255
Left = 2520
TabIndex = 15
Top = 1800
Width = 255
End
Begin VB.Label Label2
Caption = "月"
Height = 255
Left = 3600
TabIndex = 17
Top = 1800
Width = 375
End
Begin VB.Label Label3
Caption = "日"
Height = 375
Left = 4920
TabIndex = 19
Top = 1800
Width = 375
End
Begin VB.Label Label4
Caption = "总金额:"
Height = 375
Left = 3600
TabIndex = 22
Top = 2280
Width = 855
End
End
End
Attribute VB_Name = "frmAddGoods"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs_addfc As New ADODB.Recordset
Dim rs_add As New ADODB.Recordset
Private Sub cmdaddfc_Click()
txtGoodsNo.Enabled = False
If txtManufacturer.Text = "" Then
MsgBox "请填写厂商名称!", vbOKOnly + vbInformation, "注意"
txtManufacturer.SetFocus
Exit Sub
ElseIf txtCoporatation.Text = "" Then
MsgBox "请填写厂商法人代表!", vbOKOnly + vbInformation, "注意"
txtCoporatation.SetFocus
Exit Sub
ElseIf txtPhone.Text = "" Then
MsgBox "请填写电话!", vbOKOnly + vbInformation, "注意"
txtPhone.SetFocus
Exit Sub
ElseIf txtAddress.Text = "" Then
MsgBox "请填写厂商地址!", vbOKOnly + vbInformation, "注意"
txtAddress.SetFocus
Exit Sub
End If
Dim sqlfc As String
sqlfc = "select * from manufacturer"
rs_addfc.Open sqlfc, conn, adOpenKeyset, adLockPessimistic
rs_addfc.AddNew
rs_addfc.Fields(1) = txtManufacturer.Text
rs_addfc.Fields(2) = txtCoporatation.Text
rs_addfc.Fields(3) = txtPhone.Text
rs_addfc.Fields(4) = txtAddress.Text
rs_addfc.Update
MsgBox "添加厂商成功", vbOKOnly + vbExclamation, "提示"
rs_addfc.Close
End Sub
Private Sub cmdadd_Click()
txtGoodsNo.Enabled = False
If txtFc.Text = "" Then
MsgBox "请填写厂商名称!", vbOKOnly + vbInformation, "注意"
txtFc.SetFocus '使txtFc获得光标焦点
Exit Sub
ElseIf txtName.Text = "" Then
MsgBox "请填写商品名称!", vbOKOnly + vbInformation, "注意"
txtName.SetFocus
Exit Sub
ElseIf txtType.Text = "" Then
MsgBox "请填写商品型号!", vbOKOnly + vbInformation, "注意"
txtType.SetFocus
Exit Sub
ElseIf txtPrice.Text = "" Then
MsgBox "请填写商品价格!", vbOKOnly + vbInformation, "注意"
txtPrice.SetFocus
Exit Sub
ElseIf txtQuantity.Text = "" Then
MsgBox "请填写商品数量!", vbOKOnly + vbInformation, "注意"
txtQuantity.SetFocus
Exit Sub
ElseIf txtyear.Text = "" Then
MsgBox "请填写销售年份!", vbOKOnly + vbInformation, "注意"
txtyear.SetFocus
Exit Sub
ElseIf txtmon.Text = "" Then
MsgBox "请填写销售月份!", vbOKOnly + vbInformation, "注意"
txtmon.SetFocus
Exit Sub
ElseIf txtday.Text = "" Then
MsgBox "请填写销售日!", vbOKOnly + vbInformation, "注意"
txtday.SetFocus
Exit Sub
ElseIf txtem.Text = "" Then
MsgBox "请填写业务员姓名!", vbOKOnly + vbInformation, "注意"
txtem.SetFocus
Exit Sub
ElseIf txtmoney.Text = "" Then
MsgBox "请填写总金额!", vbOKOnly + vbInformation, "注意"
txtmoney.SetFocus
Exit Sub
End If
Dim sql As String
sql = "select * from goods"
rs_add.Open sql, conn, adOpenKeyset, adLockPessimistic
rs_add.AddNew
rs_add.Fields(1) = txtFc.Text
rs_add.Fields(2) = txtName.Text
rs_add.Fields(3) = txtType.Text
rs_add.Fields(4) = txtPrice.Text
rs_add.Fields(5) = Val(txtQuantity.Text) '使用Val函数把TextBox.text中的文本型数据转换成数字型数据
rs_add.Fields(6) = Val(txtmoney.Text)
rs_add.Fields(7) = txtyear.Text
rs_add.Fields(8) = txtmon.Text
rs_add.Fields(9) = txtday.Text
rs_add.Fields(10) = txtem.Text
rs_add.Update
MsgBox "添加商品入库成功", vbOKOnly + vbExclamation, "提示"
rs_add.Close
End Sub
Private Sub cmdReset_Click()
txtName.Text = ""
txtFc.Text = ""
txtType.Text = ""
txtPrice.Text = ""
txtQuantity.Text = ""
txtyear.Text = ""
txtmon.Text = ""
txtday.Text = ""
txtem.Text = ""
txtmoney.Text = ""
End Sub
Private Sub cmdResetfc_Click()
txtManufacturer.Text = ""
txtCoporatation.Text = ""
txtPhone.Text = ""
txtAddress.Text = ""
End Sub
Private Sub Form_Load()
'让窗体居中
Call MakeCenter(Me)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -