📄 tjsp.frm
字号:
VERSION 5.00
Begin VB.Form tjsp
BorderStyle = 1 'Fixed Single
Caption = "添加商品"
ClientHeight = 4365
ClientLeft = 5505
ClientTop = 2370
ClientWidth = 5100
Icon = "tjsp.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4365
ScaleWidth = 5100
Begin VB.CommandButton Command3
Caption = "返回(&B)"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3600
TabIndex = 15
Top = 3840
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "继续添加(&A)"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1680
TabIndex = 14
Top = 3840
Width = 1695
End
Begin VB.CommandButton Command1
Caption = "保存(&S)"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 240
TabIndex = 13
Top = 3840
Width = 1215
End
Begin VB.Frame Frame1
Height = 3735
Left = 0
TabIndex = 0
Top = 0
Width = 5055
Begin VB.TextBox Text7
BackColor = &H00FFFFFF&
ForeColor = &H00000000&
Height = 375
Left = 2040
TabIndex = 5
Top = 2280
Width = 2415
End
Begin VB.TextBox Text6
BackColor = &H00FFFFFF&
ForeColor = &H00000000&
Height = 375
Left = 2040
TabIndex = 3
Top = 1320
Width = 2415
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 495
Left = 0
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 3120
Visible = 0 'False
Width = 1860
End
Begin VB.TextBox Text5
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 375
Left = 2040
TabIndex = 1
Top = 360
Width = 2415
End
Begin VB.TextBox Text4
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 375
Left = 2040
TabIndex = 2
Top = 840
Width = 2415
End
Begin VB.TextBox Text3
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 375
Left = 2040
TabIndex = 4
Top = 1800
Width = 2415
End
Begin VB.TextBox Text1
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 735
Left = 2040
MultiLine = -1 'True
TabIndex = 6
Top = 2880
Width = 2415
End
Begin VB.Label Label7
Caption = "产地"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Left = 600
TabIndex = 12
Top = 2280
Width = 615
End
Begin VB.Label Label6
Caption = "计量单位"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 375
Left = 600
TabIndex = 11
Top = 1800
Width = 975
End
Begin VB.Label Label5
Caption = "备注:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Left = 600
TabIndex = 10
Top = 2880
Width = 735
End
Begin VB.Label Label3
Caption = "供货商"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Left = 600
TabIndex = 9
Top = 1320
Width = 855
End
Begin VB.Label Label2
Caption = "商品名称"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Left = 600
TabIndex = 8
Top = 840
Width = 1095
End
Begin VB.Label Label1
Caption = "商品编号"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Left = 600
TabIndex = 7
Top = 360
Width = 1095
End
End
End
Attribute VB_Name = "tjsp"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public bc As Boolean
Private Sub Command1_Click()
'czrygl.Data1.Recordset.MoveLast
bc = True
If Text4.Text = "" Then
MsgBox "商品名称不能为空。", vbCritical, "警告"
Text4.SetFocus
Exit Sub
End If
If Text5.Text = "" Then
MsgBox "商品编号不能为空。", vbCritical, "警告"
Text5.SetFocus
Exit Sub
End If
If Len(Text1.Text) > 50 Then
MsgBox "备注不要多于25个字", vbCritical, "警告"
Text1.SetFocus
Exit Sub
End If
tjsp.Data1.Recordset.AddNew
tjsp.Data1.Recordset("spbh") = Trim(Text5.Text)
tjsp.Data1.Recordset("spmc") = Trim(Text4.Text)
'If Option1.Value = True Then
tjsp.Data1.Recordset("ghs") = Trim(Text6.Text)
' Else
' tjzy.Data1.Recordset("xb") = "女"
'End If
tjsp.Data1.Recordset("dw") = Trim(Text3.Text)
'tjsp.Data1.Recordset("ys") = Trim(Text2.Text)
tjsp.Data1.Recordset("spcd") = Trim(Text7.Text)
tjsp.Data1.Recordset("bz") = Trim(Text1.Text)
tjsp.Data1.Recordset.Update
'Call Form_Activate
tjsp.Data1.Refresh
spxx.Data1.Refresh
MsgBox "商品已保存。 ", vbInformation, "提示"
End Sub
Private Sub Command2_Click()
'自动生成编号
If bc = False Then
MsgBox "请先将当前记录保存。", vbInformation, "提示"
Exit Sub
End If
'Data1.Recordset.MoveLast
'If (Val(Data1.Recordset("zybh")) + 1) < 10 Then Text5.Text = "000" & (Val(Data1.Recordset("zybh")) + 1)
'If (Val(Data1.Recordset("zybh")) + 1) >= 10 And (Val(Data1.Recordset("zybh")) + 1) < 100 Then
' Text5.Text = "00" & (Val(Data1.Recordset("zybh")) + 1)
'End If
'If (Val(Data1.Recordset("zybh")) + 1) >= 100 Then
' Text5.Text = "0" + (Val(Data1.Recordset("zybh")) + 1)
'End If
Text6.Text = ""
Text5.Text = ""
Text4.Text = ""
Text3.Text = ""
'Text2.Text = ""
Text1.Text = ""
bc = False
End Sub
Private Sub Command3_Click()
spxx.Show
Unload Me
End Sub
Private Sub Form_Activate()
'自动生成编号
Text5.SetFocus
' Data1.Recordset.MoveLast
' If (Val(Data1.Recordset("zybh")) + 1) < 10 Then Text5.Text = "000" & (Val(Data1.Recordset("zybh")) + 1)
' If (Val(Data1.Recordset("zybh")) + 1) >= 10 And (Val(Data1.Recordset("zybh")) + 1) < 100 Then
' Text5.Text = "00" & (Val(Data1.Recordset("zybh")) + 1)
' End If
' If (Val(Data1.Recordset("zybh")) + 1) > 100 Then
' Text5.Text = "0" + (Val(Data1.Recordset("zybh")) + 1)
' End If
' Text4.SetFocus
End Sub
Private Sub Form_Load()
Data1.DatabaseName = App.Path & "\db1.mdb"
Data1.RecordSource = "select * from spxx"
'Text5.SetFocus
End Sub
Private Sub Text5_Click()
' MsgBox "系统管理员不可删除", vbCritical, "警告"
End Sub
Private Sub Text5_LostFocus()
'Text3.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -