📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form frmaddgoods
Caption = "Form1"
ClientHeight = 6420
ClientLeft = 60
ClientTop = 450
ClientWidth = 6435
LinkTopic = "Form1"
ScaleHeight = 6420
ScaleWidth = 6435
StartUpPosition = 3 'Windows Default
Begin VB.Frame fraaddfc
Caption = "添加厂商"
Height = 2415
Left = 120
TabIndex = 1
Top = 3840
Width = 6015
Begin VB.CommandButton cmdresetfc
Caption = "清空重填"
Height = 375
Left = 3360
TabIndex = 34
Top = 1920
Width = 1215
End
Begin VB.CommandButton Cmdaddfc
Caption = "添加入库"
Height = 375
Left = 1200
TabIndex = 33
Top = 1920
Width = 1095
End
Begin VB.TextBox txtaddress
Height = 285
Left = 1200
TabIndex = 32
Top = 1320
Width = 4335
End
Begin VB.TextBox txtphone
Height = 285
Left = 4320
TabIndex = 30
Top = 840
Width = 1215
End
Begin VB.TextBox txtcorporation
Height = 285
Left = 1200
TabIndex = 28
Top = 840
Width = 1815
End
Begin VB.TextBox txtmanufacturer
Height = 285
Left = 1200
TabIndex = 26
Top = 360
Width = 4335
End
Begin VB.Label Label16
Caption = "厂商地址"
Height = 255
Left = 240
TabIndex = 31
Top = 1320
Width = 735
End
Begin VB.Label Label15
Caption = "电话"
Height = 255
Left = 3480
TabIndex = 29
Top = 840
Width = 495
End
Begin VB.Label Label14
Caption = "法人代表"
Height = 255
Left = 240
TabIndex = 27
Top = 840
Width = 855
End
Begin VB.Label Label13
Caption = "厂商名称"
Height = 255
Left = 240
TabIndex = 25
Top = 360
Width = 1095
End
End
Begin VB.Frame Fraaddgoods
Caption = "添加商品"
Height = 3615
Left = 120
TabIndex = 0
Top = 120
Width = 6015
Begin VB.TextBox txtname
Height = 375
Left = 4200
TabIndex = 36
Top = 360
Width = 1335
End
Begin VB.TextBox txtfc
Height = 285
Left = 1320
TabIndex = 35
Top = 840
Width = 1455
End
Begin VB.CommandButton cmdReset
Caption = "清空重填"
Height = 375
Left = 3480
TabIndex = 24
Top = 3000
Width = 1095
End
Begin VB.CommandButton cmdadd
Caption = "添加入库"
Height = 375
Left = 1200
TabIndex = 23
Top = 3000
Width = 1215
End
Begin VB.TextBox txtmoney
Height = 285
Left = 3960
TabIndex = 22
Top = 2400
Width = 1335
End
Begin VB.TextBox txtem
Height = 285
Left = 1320
TabIndex = 20
Top = 2370
Width = 1215
End
Begin VB.TextBox txtday
Height = 285
Left = 4080
TabIndex = 17
Top = 1920
Width = 735
End
Begin VB.TextBox txtmon
Height = 285
Left = 2640
TabIndex = 15
Top = 1920
Width = 615
End
Begin VB.TextBox txtyear
Height = 285
Left = 1320
TabIndex = 13
Top = 1920
Width = 615
End
Begin VB.TextBox txtquantity
Height = 285
Left = 4200
TabIndex = 7
Top = 1320
Width = 1335
End
Begin VB.TextBox txtprice
Height = 285
Left = 1320
TabIndex = 6
Top = 1320
Width = 1455
End
Begin VB.TextBox txttype
Height = 285
Left = 4200
TabIndex = 5
Top = 840
Width = 1335
End
Begin VB.TextBox txtgoodsno
Enabled = 0 'False
Height = 285
Left = 1320
TabIndex = 2
Text = "编号自动添加"
Top = 360
Width = 1455
End
Begin VB.Label Label12
Caption = "总金额"
Height = 255
Left = 3000
TabIndex = 21
Top = 2400
Width = 735
End
Begin VB.Label Label11
Caption = "业务员编号"
Height = 255
Left = 360
TabIndex = 19
Top = 2400
Width = 975
End
Begin VB.Label Label10
Caption = "日"
Height = 255
Left = 5040
TabIndex = 18
Top = 1920
Width = 495
End
Begin VB.Label Label9
Caption = "月"
Height = 255
Left = 3600
TabIndex = 16
Top = 1920
Width = 495
End
Begin VB.Label Label8
Caption = "年"
Height = 255
Left = 2160
TabIndex = 14
Top = 1920
Width = 495
End
Begin VB.Label Label7
Caption = "销售日期"
Height = 255
Left = 360
TabIndex = 12
Top = 1920
Width = 735
End
Begin VB.Label Label6
Caption = "数量"
Height = 255
Left = 3360
TabIndex = 11
Top = 1320
Width = 615
End
Begin VB.Label Label5
Caption = "单价"
Height = 255
Left = 360
TabIndex = 10
Top = 1320
Width = 615
End
Begin VB.Label Label4
Caption = "型号"
Height = 375
Left = 3360
TabIndex = 9
Top = 840
Width = 615
End
Begin VB.Label Label3
Caption = "生产厂商:"
Height = 255
Left = 360
TabIndex = 8
Top = 840
Width = 975
End
Begin VB.Label Label2
Caption = "商品名称:"
Height = 255
Left = 3240
TabIndex = 4
Top = 360
Width = 1095
End
Begin VB.Label Label1
Caption = "产品编号:"
Height = 255
Left = 360
TabIndex = 3
Top = 360
Width = 975
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 cmdadd_Click()
txtgoodsno.Enabled = False
If txtfc.Text = "" Then
MsgBox "请填写厂商名称!", vbOKOnly + vbInformation, "注意"
txtfc.SetFocus
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, adopenkyset, adLockPessimistic
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)
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 cmdaddfc_Click()
txtgoodsno.Enabled = False
If txtmanufacturer.Text = "" Then
MsgBox "请填写厂商名称!", vbOKOnly + vbInformation, "注意"
txtmanufacturer.SetFocus
Exit Sub
ElseIf txtcorporatation.Text = "" Then
MsgBox "请填写厂商法人代表!", vbOKOnly + vbinformaion, "注意"
txtcorporatation.SetFocus
Exit Sub
ElseIf txtphone.Text = "" Then
MsgBox "请填写电话!", vbOKOnly + vbInformation, "注意"
txtpone.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) = txtcorporatation.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 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 = ""
txtcorporation.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 + -