📄 pro_add.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form shangpin_luru
Caption = "商品信息录入"
ClientHeight = 6765
ClientLeft = 165
ClientTop = 735
ClientWidth = 8715
LinkTopic = "Form1"
ScaleHeight = 6765
ScaleWidth = 8715
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command5
BackColor = &H80000015&
Caption = "商品管理"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 18
Top = 5880
Width = 1935
End
Begin VB.CommandButton Command4
Caption = "仓库管理"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3000
TabIndex = 17
Top = 5880
Width = 2295
End
Begin VB.CommandButton Command3
Caption = "系统管理"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 5760
TabIndex = 16
Top = 5880
Width = 2055
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 4320
TabIndex = 14
Top = 4920
Width = 1695
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 1920
TabIndex = 13
Top = 4920
Width = 1455
End
Begin VB.Frame Frame1
Caption = "输入请商品信息"
Height = 4695
Left = 600
TabIndex = 0
Top = 120
Width = 7335
Begin VB.ComboBox Combo1
Height = 300
Left = 1080
TabIndex = 20
Text = "商品类型选择"
Top = 840
Width = 1335
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 375
Left = 4320
TabIndex = 15
Top = 240
Width = 1815
_ExtentX = 3201
_ExtentY = 661
_Version = 393216
Format = 73072641
CurrentDate = 38650
End
Begin VB.TextBox Text4
Height = 375
Left = 4320
TabIndex = 5
Top = 840
Width = 1815
End
Begin VB.TextBox Text2
Height = 375
Left = 1080
TabIndex = 4
Top = 1800
Width = 5895
End
Begin VB.TextBox Text1
Height = 375
Left = 1080
TabIndex = 3
Top = 240
Width = 1335
End
Begin VB.TextBox Text6
Height = 375
Left = 1080
TabIndex = 2
Top = 2400
Width = 5895
End
Begin VB.TextBox Text7
Height = 1215
Left = 1080
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 1
Top = 3240
Width = 5895
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "生产日期"
Height = 180
Left = 3360
TabIndex = 12
Top = 360
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "厂家地址"
Height = 180
Left = 120
TabIndex = 11
Top = 2520
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "生产厂家"
Height = 180
Left = 3360
TabIndex = 10
Top = 960
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "商品类型"
Height = 180
Left = 120
TabIndex = 9
Top = 960
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "商品名称"
Height = 180
Left = 120
TabIndex = 8
Top = 1920
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "商品编号"
Height = 180
Left = 120
TabIndex = 7
Top = 360
Width = 720
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "备 注"
Height = 180
Left = 240
TabIndex = 6
Top = 3720
Width = 630
End
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
BorderStyle = 1 'Fixed Single
Height = 735
Left = 240
TabIndex = 19
Top = 5760
Width = 8295
End
Begin VB.Menu luru
Caption = "商品信息录入"
End
Begin VB.Menu chaxun
Caption = "商品信息查询"
End
Begin VB.Menu gengxin
Caption = "商品信息更新"
End
Begin VB.Menu shanchu
Caption = "商品信息删除"
End
Begin VB.Menu tuichu
Caption = "退出"
End
End
Attribute VB_Name = "shangpin_luru"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub chaxun_Click()
shangpin_chaxun.Show
Unload Me
End Sub
Private Sub Command1_Click()
Dim rs_addpro As New ADODB.Recordset
Dim sql As String
If Trim(Text1.Text) = "" Then
MsgBox "商品编号不能为空", vbOKOnly + vbExclamation, ""
Text1.SetFocus
Exit Sub
End If
If Trim(Text2.Text) = "" Then
MsgBox "商品名称不能为空", vbOKOnly + vbExclamation, ""
Text2.SetFocus
Exit Sub
End If
If Trim(Combo1.Text) = "" Then
MsgBox "商品类型不能为空", vbOKOnly + vbExclamation, ""
Combo1.SetFocus
Exit Sub
End If
If Trim(Text4.Text) = "" Then
MsgBox "生产厂家不能为空", vbOKOnly + vbExclamation, ""
Text4.SetFocus
Exit Sub
End If
If Not IsDate(DTPicker1.Value) Then
MsgBox "请按照yyyy-mm-dd格式输入日期", vbOKOnly + vbExclamation, ""
Text5.SetFocus
Exit Sub
End If
If Trim(Text6.Text) = "" Then
MsgBox "厂址不能为空", vbOKOnly + vbExclamation, ""
Text6.SetFocus
Exit Sub
End If
If Trim(Text7.Text) = "" Then
MsgBox "备注不能为空", vbOKOnly + vbExclamation, ""
Text7.SetFocus
Exit Sub
End If
sql = "select * from 商品信息 where 商品编号='" & Text1.Text & "'"
rs_addpro.Open sql, conn, adOpenKeyset, adLockPessimistic
If rs_addpro.EOF Then
rs_addpro.AddNew
rs_addpro.Fields(0) = Trim(Text1.Text)
rs_addpro.Fields(1) = Trim(Text2.Text)
rs_addpro.Fields(2) = Trim(Combo1.Text)
rs_addpro.Fields(3) = Trim(Text4.Text)
rs_addpro.Fields(4) = Trim(DTPicker1.Value)
rs_addpro.Fields(5) = Trim(Text6.Text)
rs_addpro.Fields(6) = Trim(Text7.Text)
rs_addpro.Update
MsgBox "添加商品信息成功!", vbOKOnly, ""
rs_addpro.Close
Text1.Text = ""
Text2.Text = ""
Combo1.Text = ""
Text4.Text = ""
Text6.Text = ""
Text7.Text = ""
Else
MsgBox "商品编号重复!", vbOKOnly + vbExclamation, ""
Text1.SetFocus
Text1.Text = ""
rs_addpro.Close
Exit Sub
End If
Frame1.Refresh
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub shangpin_luru_Click()
End Sub
Private Sub Command3_Click()
gengxinmima.Show
Unload Me
End Sub
Private Sub Command4_Click()
ruku_dengji.Show
Unload Me
End Sub
Private Sub Command5_Click()
shangpin_luru.Show
End Sub
Private Sub Form_Load()
Dim rs_leibie As New ADODB.Recordset
Dim sql As String
sql = "select * from 商品类型"
rs_leibie.Open sql, conn, adOpenKeyset, adLockPessimistic
rs_leibie.MoveFirst
Do While Not rs_leibie.EOF
Combo1.AddItem rs_leibie.Fields(0)
rs_leibie.MoveNext
Loop
rs_leibie.Close
End Sub
Private Sub gengxin_Click()
shangpin_gengxin.Show
Unload Me
End Sub
Private Sub luru_Click()
shangpin_luru.Show
End Sub
Private Sub shangpin_chaxun_Click()
shangpin_chaxun.Show
End Sub
Private Sub shangpin_gengxin_Click()
shangpin_gengxin.Show
End Sub
Private Sub shanchu_Click()
shangpin_shanchu.Show
Unload Me
End Sub
Private Sub tuichu_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -