📄 frmsccp.frm
字号:
VERSION 5.00
Begin VB.Form frmxgcp
Caption = "修改产品"
ClientHeight = 8595
ClientLeft = 60
ClientTop = 345
ClientWidth = 11880
KeyPreview = -1 'True
LinkTopic = "Form1"
MaxButton = 0 'False
Moveable = 0 'False
ScaleHeight = 8595
ScaleWidth = 11880
StartUpPosition = 3 '窗口缺省
WindowState = 2 'Maximized
Begin VB.Frame Frame1
Caption = "删除产品:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 7335
Left = 600
TabIndex = 6
Top = 600
Width = 10575
Begin VB.CommandButton Command2
Caption = "确 认"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4920
TabIndex = 4
Top = 5640
Width = 1335
End
Begin VB.TextBox txtid
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4920
TabIndex = 0
Top = 1560
Width = 2415
End
Begin VB.TextBox txttm
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4920
TabIndex = 1
Top = 2880
Width = 2415
End
Begin VB.TextBox txtgg
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4920
TabIndex = 2
Top = 4320
Width = 2415
End
Begin VB.CommandButton Command1
Caption = "删 除"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2520
MaskColor = &H00FF8080&
TabIndex = 3
Top = 5640
Width = 1335
End
Begin VB.CommandButton Command3
Caption = "返 回"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 7320
TabIndex = 5
Top = 5640
Width = 1335
End
Begin VB.Label Label1
Caption = "产品编号:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 495
Left = 3120
TabIndex = 9
Top = 1560
Width = 1455
End
Begin VB.Label Label2
Caption = "规 格:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 495
Left = 3120
TabIndex = 8
Top = 4320
Width = 1455
End
Begin VB.Label Label3
Caption = "条 码:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 615
Left = 3120
TabIndex = 7
Top = 2880
Width = 1455
End
End
End
Attribute VB_Name = "frmxgcp"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Command1.Enabled = False
txtid.Enabled = True
txttm.Enabled = True
txttm.Locked = True
txtgg.Enabled = True
txtgg.Locked = True
txtid.SetFocus
Command2.Enabled = True
End Sub
Private Sub Command2_Click()
DefaultType = dbUseODBC
Dim db As Database
Dim rs As Recordset
Dim cx As Boolean
cx = False
Set db = OpenDatabase("xsys", dbDriverNoPrompt, False, "odbc;database=glxt;uid=;pwd=;dsn=xsys")
Set rs = db.OpenRecordset("xhk", dbOpenDynaset, dbwrite, dbOptimistic)
If txtid.Text = "" Then
MsgBox "填写不能为空,请重新输入!", vbInformation, "提示"
Else
rs.MoveFirst
Do While rs.EOF <> True
If rs.Fields("产品编号") = LTrim(txtid.Text) Then
cx = True
Exit Do
Else
rs.MoveNext
End If
Loop
If MsgBox("请确认填写无误,否则修改!", vbOKCancel, "提示") = vbOK Then
txttm.Locked = False
txtgg.Locked = False
If cx = True Then
With rs
.Delete
End With
txtid.Text = ""
txtid.Enabled = False
txttm.Text = ""
txttm.Enabled = False
txtgg.Text = ""
txtgg.Enabled = False
Command1.Enabled = True
Command2.Enabled = False
End If
Else
txtid.SetFocus
End If
rs.Close
db.Close
End If
End Sub
Private Sub Command3_Click()
Unload Me
frmmenu.Show
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
Dim nexttabindex As Integer, i As Integer
If KeyAscii = 13 Then
If Screen.ActiveControl.TabIndex = Count - 1 Then
nexttabindex = 0
Else
nexttabindex = Screen.ActiveControl.TabIndex + 1
End If
For i = 0 To Count - 1
If Me.Controls(i).TabIndex = nexttabindex Then
Me.Controls(i).SetFocus
Exit For
End If
If nexttabindex = 3 Then
Command2.SetFocus
Exit For
End If
Next i
KeyAscii = 0
End If
End Sub
Private Sub Form_Load()
txtid.Enabled = False
txttm.Enabled = False
txtgg.Enabled = False
Command2.Enabled = False
End Sub
Private Sub txtid_LostFocus()
DefaultType = dbUseODBC
Dim db As Database
Dim rs As Recordset
Dim cx As Boolean
cx = False
Set db = OpenDatabase("xsys", dbDriverNoPrompt, False, "odbc;database=glxt;uid=;pwd=;dsn=xsys")
Set rs = db.OpenRecordset("xhk", dbOpenDynaset, dbwrite, dbOptimistic)
If txtid.Text = "" Then
If MsgBox("填写不能为空,请重新输入!", vbOKCancel, "错误") = vbOK Then
Command3.SetFocus
Else
Command3.SetFocus
End If
Else
rs.MoveFirst
Do While rs.EOF <> True
If rs.Fields("产品编号") = LTrim(txtid.Text) Then
cx = True
Exit Do
Else
rs.MoveNext
End If
Loop
If cx = False Then
MsgBox "此产品编号不存在,请重新输入!", vbCritical, "错误"
txtid.Text = ""
txtid.SetFocus
Else
txttm.Enabled = True
txtgg.Enabled = True
txttm.Text = rs.Fields("条码")
txtgg.Text = rs.Fields("规格")
txttm.Locked = True
txtgg.Locked = True
End If
rs.Close
db.Close
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -