📄 商品档案管理.frm
字号:
VERSION 5.00
Begin VB.Form 商品档案管理
Caption = "商品档案管理"
ClientHeight = 8040
ClientLeft = 60
ClientTop = 345
ClientWidth = 10935
LinkTopic = "Form1"
ScaleHeight = 8040
ScaleWidth = 10935
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command4
Caption = "退 出"
BeginProperty Font
Name = "华文新魏"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 675
Left = 7980
TabIndex = 23
Top = 7110
Width = 1545
End
Begin VB.CommandButton Command3
Caption = "修改档案"
BeginProperty Font
Name = "华文新魏"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 675
Left = 6090
TabIndex = 22
Top = 7110
Width = 1485
End
Begin VB.CommandButton Command2
Caption = "查询档案"
BeginProperty Font
Name = "华文新魏"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 675
Left = 4170
TabIndex = 21
Top = 7110
Width = 1425
End
Begin VB.CommandButton Command1
Caption = "保存档案"
BeginProperty Font
Name = "华文新魏"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 675
Left = 2280
TabIndex = 20
Top = 7110
Width = 1425
End
Begin VB.TextBox Text1
Height = 525
Index = 9
Left = 6990
TabIndex = 19
Top = 5910
Width = 3555
End
Begin VB.TextBox Text1
Height = 525
Index = 8
Left = 6990
TabIndex = 18
Top = 4320
Width = 3555
End
Begin VB.TextBox Text1
Height = 525
Index = 7
Left = 6960
TabIndex = 17
Top = 2820
Width = 3555
End
Begin VB.TextBox Text1
Height = 525
Index = 6
Left = 6960
TabIndex = 16
Top = 1530
Width = 3555
End
Begin VB.TextBox Text1
Height = 525
Index = 5
Left = 6960
TabIndex = 15
Top = 420
Width = 3555
End
Begin VB.TextBox Text1
Height = 525
Index = 4
Left = 1470
TabIndex = 14
Top = 5850
Width = 3555
End
Begin VB.TextBox Text1
Height = 525
Index = 3
Left = 1470
TabIndex = 13
Top = 4260
Width = 3555
End
Begin VB.TextBox Text1
Height = 525
Index = 2
Left = 1500
TabIndex = 12
Top = 2880
Width = 3555
End
Begin VB.TextBox Text1
Height = 525
Index = 1
Left = 1470
TabIndex = 11
Top = 1620
Width = 3555
End
Begin VB.TextBox Text1
Height = 525
Index = 0
Left = 1470
TabIndex = 10
Top = 450
Width = 3555
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Label1"
Height = 555
Index = 9
Left = 5550
TabIndex = 9
Top = 6060
Width = 1755
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Label1"
Height = 555
Index = 8
Left = 5550
TabIndex = 8
Top = 4500
Width = 1755
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Label1"
Height = 555
Index = 7
Left = 5550
TabIndex = 7
Top = 3000
Width = 1755
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Label1"
Height = 555
Index = 6
Left = 5550
TabIndex = 6
Top = 1710
Width = 1755
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Label1"
Height = 555
Index = 5
Left = 5550
TabIndex = 5
Top = 570
Width = 1755
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Label1"
Height = 555
Index = 4
Left = 540
TabIndex = 4
Top = 6000
Width = 1755
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Label1"
Height = 555
Index = 3
Left = 540
TabIndex = 3
Top = 4470
Width = 1755
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Label1"
Height = 555
Index = 2
Left = 540
TabIndex = 2
Top = 3000
Width = 1755
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Label1"
Height = 555
Index = 1
Left = 540
TabIndex = 1
Top = 1740
Width = 1755
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Label1"
Height = 555
Index = 0
Left = 540
TabIndex = 0
Top = 570
Width = 1665
End
End
Attribute VB_Name = "商品档案管理"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Dim txtSQL As String
Dim txtsql1(0 To 9) As String
Dim mrc As ADODB.Recordset
Dim MsgText As String
If Trim(Text1(1).Text) = "" Then
MsgBox "请输入商品名称!", vbOKOnly + vbExclamation, "警告"
Exit Sub
Text1(1).SetFocus
Else
txtSQL = "select * from 修改商品档案管理"
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.AddNew
Dim i As Integer
For i = 0 To 9
mrc.Fields(i) = Trim(Text1(i).Text)
Next i
mrc.Update
mrc.Close
MsgBox "添加商品成功!", vbOKOnly + vbExclamation, "添加商品"
Exit Sub
Unload Me
End If
End Sub
Private Sub Command2_Click()
Dim mrc As ADODB.Recordset
Dim MsgText As String
Dim i, b, c, d As Integer
Dim v As Integer
For i = 0 To 9
If Trim(Text1(i).Text) = "" Then v = v + 1
Next i
If v = 10 Then
MsgBox "没有选择查询条件!"
Exit Sub
End If
Dim txtSQL(0 To 9) As String
Dim K(0 To 9) As Integer
For d = 0 To 9
If Trim(Text1(d).Text) <> "" Then
K(d) = d
Select Case K(d)
Case 0
txtSQL(0) = "select * from 数据存取表 where 商品编码 = '" & Text1(0).Text & "'"
Set mrc = ExecuteSQL(txtSQL(0), MsgText)
If mrc.EOF = True Then
MsgBox "对不起,暂时没有符合条件的商品!", vbOKOnly + vbExclamation, "警告"
End If
Case 1
txtSQL(0) = "select * from 数据存取表 where 商品名称 = '" & Text1(1).Text & "'"
Set mrc = ExecuteSQL(txtSQL(1), MsgText)
If mrc.EOF = True Then
MsgBox "对不起,暂时没有符合条件的商品!", vbOKOnly + vbExclamation, "警告"
End If
Case 2
txtSQL(2) = "select * from 数据存取表 where 规格型号 = '" & Text1(2).Text & "'"
Set mrc = ExecuteSQL(txtSQL(2), MsgText)
If mrc.EOF = True Then
MsgBox "对不起,暂时没有符合条件的商品!", vbOKOnly + vbExclamation, "警告"
End If
Case 3
txtSQL(3) = "select * from 数据存取表 where 商品经营方式 = '" & Text1(3).Text & "'"
Set mrc = ExecuteSQL(txtSQL(3), MsgText)
If mrc.EOF = True Then
MsgBox "对不起,暂时没有符合条件的商品!", vbOKOnly + vbExclamation, "警告"
End If
Case 4
txtSQL(4) = "select * from 数据存取表 where 零售价格 = '" & Text1(4).Text & "'"
Set mrc = ExecuteSQL(txtSQL(4), MsgText)
If mrc.EOF = True Then
MsgBox "对不起,暂时没有符合条件的商品!", vbOKOnly + vbExclamation, "警告"
End If
Case 5
txtSQL(5) = "select * from 数据存取表 where 商品货号 = '" & Text1(5).Text & "'"
Set mrc = ExecuteSQL(txtSQL(5), MsgText)
If mrc.EOF = True Then
MsgBox "对不起,暂时没有符合条件的商品!", vbOKOnly + vbExclamation, "警告"
End If
Case 6
txtSQL(6) = "select * from 数据存取表 where 商品产地 = '" & Text1(6).Text & "'"
Set mrc = ExecuteSQL(txtSQL(6), MsgText)
If mrc.EOF = True Then
MsgBox "对不起,暂时没有符合条件的商品!", vbOKOnly + vbExclamation, "警告"
End If
Case 7
txtSQL(7) = "select * from 数据存取表 where 最低售价 = '" & Text1(7).Text & "'"
Set mrc = ExecuteSQL(txtSQL(7), MsgText)
If mrc.EOF = True Then
MsgBox "对不起,暂时没有符合条件的商品!", vbOKOnly + vbExclamation, "警告"
End If
Case 8
txtSQL(8) = "select * from 数据存取表 where 商品税率 = '" & Text1(8).Text & "'"
Set mrc = ExecuteSQL(txtSQL(8), MsgText)
If mrc.EOF = True Then
MsgBox "对不起,暂时没有符合条件的商品!", vbOKOnly + vbExclamation, "警告"
End If
Case 9
txtSQL(9) = "select * from 数据存取表 where 整件售价= '" & Text1(9).Text & "'"
Set mrc = ExecuteSQL(txtSQL(9), MsgText)
If mrc.EOF = True Then
MsgBox "对不起,暂时没有符合条件的商品!", vbOKOnly + vbExclamation, "警告"
End If
End Select
End If
Next d
数据查询结果.txtSQL = txtSQL(0) & txtSQL(1) & txtSQL(2) & txtSQL(3) & txtSQL(4) & txtSQL(5) & txtSQL(6) & txtSQL(7) & txtSQL(8) & txtSQL(9)
数据查询结果.Show
End Sub
Private Sub Command3_Click()
Unload 商品档案管理
修改商品档案.Show
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Form_Load()
Label1(0).Caption = "商品编码"
Label1(1).Caption = "商品名称"
Label1(2).Caption = "规格型号"
Label1(3).Caption = "经营方式"
Label1(4).Caption = "零售价格"
Label1(5).Caption = "商品库存量"
Label1(6).Caption = "商品产地"
Label1(7).Caption = "最低售价"
Label1(8).Caption = "税率"
Label1(9).Caption = "整件售价"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -