📄 商品资料设置.frm
字号:
VERSION 5.00
Begin VB.Form 商品资料设置
Caption = "商品资料设置"
ClientHeight = 5490
ClientLeft = 3900
ClientTop = 2925
ClientWidth = 8940
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 5490
ScaleWidth = 8940
Begin VB.CommandButton Command2
Caption = "退 出"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 5400
TabIndex = 11
Top = 4080
Width = 1215
End
Begin VB.Frame Frame1
Height = 2775
Left = 240
TabIndex = 1
Top = 720
Width = 8415
Begin VB.TextBox Text4
Height = 375
Left = 6840
TabIndex = 12
Top = 1200
Width = 1215
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1680
TabIndex = 8
Top = 2040
Width = 1335
End
Begin VB.TextBox Text3
Height = 375
Left = 6840
TabIndex = 7
Top = 360
Width = 1215
End
Begin VB.TextBox Text2
Height = 375
Left = 1680
TabIndex = 6
Top = 1200
Width = 1935
End
Begin VB.TextBox Text1
Height = 375
Left = 1680
TabIndex = 5
Top = 360
Width = 1935
End
Begin VB.Label Label5
Caption = "售 价"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 5160
TabIndex = 10
Top = 1320
Width = 855
End
Begin VB.Label Label4
Caption = "成 本 价"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 5040
TabIndex = 9
Top = 480
Width = 1095
End
Begin VB.Label Label3
Caption = "单 位"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 4
Top = 2040
Width = 975
End
Begin VB.Label Label2
Caption = "商品编号"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 3
Top = 1200
Width = 1215
End
Begin VB.Label Label1
Caption = "商品名称"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 2
Top = 360
Width = 1215
End
End
Begin VB.CommandButton Command1
Caption = "保存设置"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2160
TabIndex = 0
Top = 4080
Width = 1215
End
Begin VB.Image Image1
Height = 5955
Left = -360
Picture = "商品资料设置.frx":0000
Top = -360
Width = 9360
End
Begin VB.Label Label6
BackColor = &H00E0E0E0&
Caption = "在 此 设 置 商 品 资 料"
BeginProperty Font
Name = "华文彩云"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 375
Left = 600
TabIndex = 13
Top = 240
Width = 3855
End
End
Attribute VB_Name = "商品资料设置"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim sql As String
Dim i As String
Dim rs As ADODB.Recordset
i = MsgBox("确定添加吗?", vbOKCancel, "")
If i = 1 Then
If Trim(Text1.Text) <> "" Then '检测商品编号文本框是否为空
If Trim(Text2.Text) <> "" Then '检测商品名称文本框是否为空
If Trim(Combo1.Text) <> "" Then '检测单位是否为空
sql = "select * from jldwb where dwmc='" & Trim(Combo1.Text) & "'"
Set rs = exesql(sql)
If rs.RecordCount > 0 Then
If Trim(Text3.Text) <> "" Then
If Trim(Text4.Text) <> "" Then
sql = "select * from spxxb"
Set rs = exesql(sql)
rs.AddNew '将新的商品资料添加到数据库
rs.Fields("spmc") = Trim(Text1.Text)
rs.Fields("spbh") = Trim(Text2.Text)
rs.Fields("dw") = Trim(Combo1.Text)
rs.Fields("cbj") = Trim(Text3.Text)
rs.Fields("sj") = Trim(Text4.Text)
rs.Update
Set rs = Nothing
MsgBox "添加成功!"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Combo1.Text = ""
Text1.SetFocus
Else: MsgBox "售价不能为空!"
Text4.SetFocus
End If
Else: MsgBox "成本价不能为空!"
Text3.SetFocus
End If
Else: MsgBox "该单位不存在!"
Combo1.SetFocus
End If
Else: MsgBox "单位不能为空!"
Combo1.SetFocus
End If
Else: MsgBox "商品编号不能为空!"
Text2.SetFocus
End If
Else: MsgBox "商品名称不能为空!"
Text1.SetFocus
End If
End If
End Sub
Private Sub Command2_Click()
Unload 商品资料设置
End Sub
Private Sub Form_Load()
Call listinitial("dw", Combo1)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -