📄 main_yxzy_yxlpgl_lr.frm
字号:
VERSION 5.00
Begin VB.Form main_yxzy_yxlpgl_lr
BorderStyle = 3 'Fixed Dialog
Caption = "Form1"
ClientHeight = 2265
ClientLeft = 45
ClientTop = 330
ClientWidth = 6075
Icon = "main_yxzy_yxlpgl_lr.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2265
ScaleWidth = 6075
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command1
Caption = "确定"
Height = 390
Left = 1230
TabIndex = 12
Top = 1770
Width = 1770
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 390
Left = 3120
TabIndex = 11
Top = 1770
Width = 1770
End
Begin VB.Frame Frame1
Height = 1725
Left = 30
TabIndex = 0
Top = -60
Width = 6045
Begin VB.TextBox Text1
Height = 330
Index = 6
Left = 780
TabIndex = 17
Top = 1290
Width = 5175
End
Begin VB.TextBox txtID
Height = 330
Left = 4080
TabIndex = 16
Top = 180
Visible = 0 'False
Width = 1875
End
Begin VB.TextBox Text1
Height = 330
Index = 5
Left = 4890
TabIndex = 13
Top = 915
Width = 1065
End
Begin VB.TextBox Text1
Height = 330
Index = 1
Left = 780
TabIndex = 5
Top = 540
Width = 2310
End
Begin VB.TextBox Text1
Height = 330
Index = 2
Left = 3630
TabIndex = 4
Top = 540
Width = 2325
End
Begin VB.TextBox Text1
Height = 330
Index = 3
Left = 780
TabIndex = 3
Top = 915
Width = 1065
End
Begin VB.TextBox Text1
Height = 330
Index = 0
Left = 780
TabIndex = 2
Top = 180
Width = 2865
End
Begin VB.TextBox Text1
Height = 330
Index = 4
Left = 2925
TabIndex = 1
Top = 915
Width = 1065
End
Begin VB.Label Label5
Caption = "特点"
Height = 165
Left = 345
TabIndex = 18
Top = 1380
Width = 420
End
Begin VB.Label lblID
BackStyle = 0 'Transparent
Caption = "ID"
Height = 180
Left = 3765
TabIndex = 15
Top = 255
Visible = 0 'False
Width = 225
End
Begin VB.Label Label3
Caption = "库存数量"
Height = 165
Left = 4065
TabIndex = 14
Top = 990
Width = 795
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "礼品名称"
ForeColor = &H000000FF&
Height = 165
Left = 45
TabIndex = 10
Top = 255
Width = 735
End
Begin VB.Label Label2
Caption = "规格"
ForeColor = &H000000FF&
Height = 165
Left = 360
TabIndex = 9
Top = 615
Width = 390
End
Begin VB.Label Label4
Caption = "单价"
Height = 165
Left = 3150
TabIndex = 8
Top = 630
Width = 405
End
Begin VB.Label Label8
Caption = "总数量"
Height = 165
Left = 195
TabIndex = 7
Top = 990
Width = 600
End
Begin VB.Label Label6
Caption = "已发放数量"
Height = 165
Left = 1920
TabIndex = 6
Top = 990
Width = 945
End
End
End
Attribute VB_Name = "main_yxzy_yxlpgl_lr"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs1 As New ADODB.Recordset
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Activate()
Text1(0).SetFocus
End Sub
Private Sub Form_Load()
If blnAddLP = True Then
Me.Caption = "礼品信息添加"
For i = 1 To Text1.UBound
Text1(i) = ""
Next i
Else
Me.Caption = "礼品信息修改"
With main_yxzy_yxlpgl.Adodc1.Recordset
lblID.Visible = True
txtID.Visible = True
txtID.text = .Fields("ID")
For i = 0 To Text1.UBound
Text1(i) = .Fields(i + 1)
Next i
End With
End If
End Sub
Private Sub Text1_Change(Index As Integer)
If Index = 3 Or 4 Then
Text1(5) = Val(Text1(3)) - Val(Text1(4))
End If
End Sub
Private Sub Text1_GotFocus(Index As Integer)
Text1(Index).BackColor = &HFFFF00
Text1(Index).SelStart = 0
Text1(Index).SelLength = Len(Text1(Index))
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn And Index < 6 Then Text1(Index + 1).SetFocus
If KeyCode = vbKeyReturn And Index = 6 Then Command1.SetFocus
End Sub
Private Sub Text1_LostFocus(Index As Integer)
Text1(Index).BackColor = &H80000005
End Sub
Private Sub Command1_Click()
On Error GoTo SaveErr
If blnAddLP = True Then
Cnn.Execute ("insert into 礼品表 values('" + Text1(0) + "','" + Text1(1) + "'," + Text1(2) + _
"," + Text1(3) + "," + Text1(4) + "," + Text1(5) + ",'" + Text1(6) + "')")
Else
Cnn.Execute ("update 礼品表 set 礼品名称='" + Text1(0) + "',规格='" + Text1(1) + "',单价=" + Text1(2) + _
",总数量=" + Text1(3) + ",已发放数量=" + Text1(4) + ",库存数量=" + Text1(5) + ",特点='" + Text1(6) + _
"'where ID =" + txtID + "")
End If
main_yxzy_yxlpgl.Adodc1.Refresh
If LPBookmark <> "" Then main_yxzy_yxlpgl.DataGrid1.Bookmark = LPBookmark
Unload Me
Exit Sub
SaveErr:
MsgBox Err.Description
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -