📄 frmbasiccolorlayoutinfo.frm
字号:
VERSION 5.00
Object = "{4932CEF1-2CAA-11D2-A165-0060081C43D9}#2.0#0"; "Actbar2.OCX"
Begin VB.Form frmBasicColorLayoutInfo
Caption = "颜色花型"
ClientHeight = 3885
ClientLeft = 60
ClientTop = 345
ClientWidth = 4080
LinkTopic = "Form1"
ScaleHeight = 3885
ScaleWidth = 4080
StartUpPosition = 3 'Windows Default
Begin ActiveBar2LibraryCtl.ActiveBar2 ActiveBar21
Height = 3885
Left = 0
TabIndex = 0
Top = 0
Width = 4080
_LayoutVersion = 1
_ExtentX = 7197
_ExtentY = 6853
_DataPath = ""
Bands = "frmBasicColorLayoutInfo.frx":0000
Begin VB.Frame Frame1
Height = 3255
Left = 60
TabIndex = 1
Top = 540
Width = 3915
Begin VB.TextBox txtUpdateDate
BackColor = &H8000000F&
Enabled = 0 'False
Height = 315
Left = 1500
TabIndex = 9
Top = 2160
Width = 1995
End
Begin VB.TextBox txtUpdateOperator
Height = 315
Left = 1500
MaxLength = 20
TabIndex = 8
Top = 1680
Width = 1995
End
Begin VB.CommandButton cmdClose
Caption = "關閉 &C"
Height = 315
Left = 2220
TabIndex = 7
Top = 2760
Width = 855
End
Begin VB.CommandButton cmdOk
Caption = "確定 &A"
Height = 315
Left = 840
TabIndex = 6
Top = 2760
Width = 855
End
Begin VB.TextBox txteColorLayout
BackColor = &H00C0C0FF&
Height = 315
Left = 1500
MaxLength = 20
TabIndex = 5
Top = 300
Width = 1995
End
Begin VB.TextBox txtColorLayout
BackColor = &H00C0C0FF&
Height = 315
Left = 1500
MaxLength = 20
TabIndex = 4
Top = 720
Width = 1995
End
Begin VB.ComboBox comboProcess
Height = 315
Left = 1500
TabIndex = 3
Text = "漂白"
Top = 1200
Width = 1995
End
Begin VB.TextBox txtid
Height = 285
Left = 300
TabIndex = 2
Text = "Text1"
Top = 2580
Visible = 0 'False
Width = 315
End
Begin VB.Label Label2
Caption = "填入日期"
Height = 255
Left = 480
TabIndex = 14
Top = 2160
Width = 975
End
Begin VB.Label Label1
Caption = "填寫人"
Height = 255
Left = 480
TabIndex = 13
Top = 1680
Width = 735
End
Begin VB.Label Label3
Caption = "中文名称"
Height = 255
Index = 2
Left = 480
TabIndex = 12
Top = 780
Width = 1035
End
Begin VB.Label Label3
Caption = "工藝"
Height = 255
Index = 0
Left = 480
TabIndex = 11
Top = 1260
Width = 1035
End
Begin VB.Label Label4
Caption = "英文名稱"
Height = 255
Left = 480
TabIndex = 10
Top = 360
Width = 1035
End
End
End
End
Attribute VB_Name = "frmBasicColorLayoutInfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public newItem As Boolean 'true表示增加
Private Sub ActiveBar21_ToolClick(ByVal Tool As ActiveBar2LibraryCtl.Tool)
Select Case Tool.Name
Case "cmdSave":
Save newItem
Case "cmdCancel":
Unload Me
Case "cmdDel":
DelOperatorInf
End Select
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdOk_Click()
Save newItem
End Sub
Private Sub Form_Load()
Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
InitTitle
Initcbb comboProcess, "eProcess", "tBasicProcess"
End Sub
Private Sub InitTitle()
Label3.item(2).Caption = "中文名称"
Label4.Caption = "英文名稱"
Label3.item(0).Caption = "工藝"
Label1.Caption = "填寫人"
Label2.Caption = "填入日期"
cmdOk.Caption = "確定 &O"
cmdClose.Caption = "關閉 &C"
Me.Caption = "顏色花型信息"
End Sub
Private Sub DelOperatorInf()
Dim strSql As String
On Error GoTo errHandle
If MsgBox("确定要刪除?", vbQuestion + vbYesNo, "询问") = vbNo Then
Exit Sub
Else
strSql = "delete from tBasicColorLayout where id=" & txtId
objDatabase.ExecCmd strSql
MsgBox "刪除成功!", vbInformation, "提示"
End If
frmBasicColorLayout.FillMshf1 ("select * from tBasicColorLayout")
Unload Me
Exit Sub
errHandle:
objDatabase.DatabaseError
End Sub
Public Sub InitInfo(strId As String)
If newItem = False Then
Dim rs As ADODB.Recordset
SystemExecuteStart Me
' On Error GoTo errLabel
Set rs = New ADODB.Recordset
With rs
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
Set .ActiveConnection = Cn
End With
Dim strSql As String
strSql = "select * from tBasicColorLayout where id=" & strId
rs.Open strSql
If Not rs.EOF Then
txteColorLayout = NullValue(rs.Fields!eColorLayout)
txtColorLayout = NullValue(rs.Fields!ColorLayout)
comboProcess.Text = NullValue(rs.Fields!Process)
txtUpdateOperator = NullValue(rs.Fields!UpdateOperator)
txtUpdateDate = NullValue(rs.Fields!UpdateDate)
txtId = NullValue(rs.Fields!ID)
End If
rs.Close
Set rs = Nothing
SystemExecuteEnd Me
End If
Exit Sub
errLabel:
SystemExecuteEnd Me
objDatabase.DatabaseError
End Sub
Private Sub Save(Optional blModi As Boolean)
Dim strSql As String
Dim rs As ADODB.Recordset
Dim rsobj As ADODB.Recordset
Set rsobj = New ADODB.Recordset
strSql = "select * from tBasicColorLayout where id=" & txtId
On Error GoTo errHandle
Set rs = New ADODB.Recordset
With rs
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
Set .ActiveConnection = Cn
End With
rs.Open strSql
If txteColorLayout.Text = "" Then
MsgBox "英文名稱不能為空!", vbCritical, "提示"
rs.Close
Set rs = Nothing
txteColorLayout.SetFocus
Exit Sub
End If
If txtColorLayout.Text = "" Then
MsgBox "中文名称不能為空!", vbCritical, "提示"
rs.Close
Set rs = Nothing
txtColorLayout.SetFocus
Exit Sub
End If
If blModi Then
rsobj.Open "select * fro tBasicColorLayout where eLayoutColor='" & txteColorLayout & "'"
If Not rsobj.EOF Then
MsgBox "此顏色花型已存在!", vbCritical, "提示"
txteColorLayout.Text = ""
txteColorLayout.SetFocus
rsobj.Close
Set rsobj = Nothing
Exit Sub
End If
If MsgBox("是否增加新的顏色花型?", vbQuestion + vbYesNo, "询问") = vbNo Then
rs.Close
Set rs = Nothing
Exit Sub
End If
rs.AddNew '新建
rs.Fields!eColorLayout = Trim$(txteColorLayout)
rs.Fields!ColorLayout = Trim$(txtColorLayout)
rs.Fields!Process = Trim$(comboProcess)
rs.Fields!UpdateOperator = Trim$(txtUpdateOperator.Text)
rs.Fields!UpdateDate = Now
rs.Update
MsgBox "新建成功!", vbInformation, "恭喜'"
Else
If rs.EOF Then '修改
MsgBox "没有可修改的记录!", vbExclamation, "修改"
rs.Close
Set rs = Nothing
txteColorLayout.SetFocus
Exit Sub
End If
If MsgBox("是否修改记录?", vbYesNo + vbQuestion, "修改") = vbNo Then
rs.Close
Set rs = Nothing
Exit Sub
End If
rs.Fields!eColorLayout = Trim$(txteColorLayout)
rs.Fields!ColorLayout = Trim$(txtColorLayout)
rs.Fields!Process = Trim$(comboProcess)
rs.Fields!UpdateOperator = Trim$(txtUpdateOperator.Text)
rs.Fields!UpdateDate = Now
rs.Update
MsgBox "修改成功!", vbInformation, "恭喜"
End If
rs.Close
Set rs = Nothing
frmBasicColorLayout.FillMshf1 ("select * from tBasicColorLayout")
Unload Me
Exit Sub
errHandle:
Set rs = Nothing
objDatabase.DatabaseError
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -