📄 frm_area_customer_edit.frm
字号:
VERSION 5.00
Begin VB.Form Frm_Area_Customer_Edit
BorderStyle = 1 'Fixed Single
Caption = "地区及客户编码"
ClientHeight = 3195
ClientLeft = 4755
ClientTop = 4575
ClientWidth = 5790
Icon = "Frm_Area_Customer_Edit.frx":0000
LinkTopic = "Form2"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3195
ScaleWidth = 5790
Begin VB.TextBox Txt_Fields_Dustproof
Height = 375
Left = 1680
TabIndex = 12
Text = "Text1"
Top = 1920
Width = 3255
End
Begin VB.TextBox Txt_Fields
Height = 375
Index = 1
Left = 1680
TabIndex = 1
Text = "Text1"
Top = 645
Width = 3615
End
Begin VB.TextBox Txt_Fields
Height = 375
Index = 2
Left = 1680
TabIndex = 2
Text = "Text1"
Top = 1075
Width = 3615
End
Begin VB.TextBox Txt_Fields
Height = 375
Index = 3
Left = 1680
TabIndex = 3
Text = "Text1"
Top = 1485
Width = 3615
End
Begin VB.TextBox Txt_Fields
Height = 375
Index = 0
Left = 1680
TabIndex = 0
Text = "Text1"
Top = 240
Width = 3615
End
Begin VB.CommandButton Cmd_Exit
Caption = "退出(&Exit)"
Height = 375
Left = 4260
TabIndex = 6
Top = 2640
Width = 1335
End
Begin VB.CommandButton Cmd_Save
Caption = "保存(&Save)"
Height = 375
Left = 2835
TabIndex = 4
Top = 2640
Width = 1335
End
Begin VB.CommandButton Cmd_Add
Caption = "添加(&Add)"
Height = 375
Left = 1395
TabIndex = 5
Top = 2640
Visible = 0 'False
Width = 1335
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "‰"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 285
Left = 5040
TabIndex = 13
Top = 1965
Width = 285
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "防尘垫要求"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 450
TabIndex = 11
Top = 2002
Width = 1050
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "地址名称"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 660
TabIndex = 10
Top = 720
Width = 840
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "客户编码"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 660
TabIndex = 9
Top = 1155
Width = 840
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "客户名称"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 660
TabIndex = 8
Top = 1560
Width = 840
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "地区编码"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 660
TabIndex = 7
Top = 315
Width = 840
End
Begin VB.Line Line1
X1 = 0
X2 = 6120
Y1 = 2400
Y2 = 2400
End
End
Attribute VB_Name = "Frm_Area_Customer_Edit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmd_Exit_Click()
Unload Me
End Sub
Private Sub cmd_Save_Click()
On Error GoTo err
'添加
If YN_Area_Customer_Add = True And YN_Area_Customer_Rename = False Then
'添加地区
If Len(AreaCustomer_Key) = 2 Then
Me.txt_Fields(0).text = Trim(Me.txt_Fields(0).text)
Me.txt_Fields(1).text = Trim(Me.txt_Fields(1).text)
Me.txt_Fields(2).text = Trim(Me.txt_Fields(2).text)
Me.txt_Fields(3).text = Trim(Me.txt_Fields(3).text)
Me.Txt_Fields_Dustproof.text = Trim(Me.Txt_Fields_Dustproof.text)
If Len(Me.txt_Fields(0).text) <> 2 Then
MsgBox "地区代码只能为2位!" + Chr(13) + "请重新输入!", vbOKOnly + vbCritical, "提示信息"
Exit Sub
End If
If Len(Me.txt_Fields(2).text) <> 5 Then
MsgBox "客户代码只能为5位!" + Chr(13) + "请重新输入!", vbOKOnly + vbCritical, "提示信息"
Exit Sub
End If
If Left(Me.txt_Fields(2).text, 2) <> Me.txt_Fields(0).text Then
MsgBox "客户代码的前2位与地区代码不相同!" + Chr(13) + "请重新输入!", vbOKOnly + vbCritical, "提示信息"
Exit Sub
End If
Set Cn = New ADODB.Connection
Cn.Open Cs
Set Rs = New ADODB.Recordset
Rs.Open "select * from Area_Customer where 地区编码 = '" & Me.txt_Fields(0).text & "'", Cn, adOpenKeyset, adLockOptimistic, adCmdText
If Rs.RecordCount = 0 Then
If Me.txt_Fields(0).text <> "" And Me.txt_Fields(1).text <> "" And Me.txt_Fields(2).text <> "" And Me.txt_Fields(3).text <> "" And Me.Txt_Fields_Dustproof.text <> "" Then
Cn.Execute "insert into Area_Customer (地区编码,地区名称,客户编码,客户名称,防尘垫要求) values ('" & Me.txt_Fields(0).text & "','" & Me.txt_Fields(1).text & "','" & Me.txt_Fields(2).text & "','" & Me.txt_Fields(3).text & "'," & Val(Me.Txt_Fields_Dustproof.text) & ")"
' MsgBox "数据保存成功", vbInformation, "提示"
For i = 0 To 3
Me.txt_Fields(i).text = ""
Next i
Me.Txt_Fields_Dustproof.text = ""
Me.txt_Fields(0).SetFocus
Frm_Customer_Riches.Tvw_Customer.Nodes.Clear
Call Frm_Customer_Riches.Tree_Change
Unload Me
Else
MsgBox "填写信息不完整,请检查。", vbCritical, "提示信息"
Exit Sub
End If
Else
MsgBox "此地区代码已重复!" + Chr(13) + "请重新输入!", vbCritical, "提示信息"
Exit Sub
End If
Rs.Close
Cn.Close
'添加客户
Else
If Len(AreaCustomer_Key) = 5 Then
Me.txt_Fields(2).text = Trim(Me.txt_Fields(2).text)
Me.txt_Fields(3).text = Trim(Me.txt_Fields(3).text)
Me.Txt_Fields_Dustproof.text = Trim(Me.Txt_Fields_Dustproof.text)
If Len(Me.txt_Fields(2).text) <> 5 Then
MsgBox "客户代码只能为5位!" + Chr(13) + "请重新输入!", vbOKOnly + vbCritical, "提示信息"
Exit Sub
End If
If Left(Me.txt_Fields(2).text, 2) <> Me.txt_Fields(0).text Then
MsgBox "客户代码的前2位与地区代码不相同!" + Chr(13) + "请重新输入!", vbOKOnly + vbCritical, "提示信息"
Exit Sub
End If
Set Cn = New ADODB.Connection
Cn.Open Cs
Set Rs = New ADODB.Recordset
Rs.Open "select * from Area_Customer where 客户编码 = '" & Me.txt_Fields(2).text & "'", Cn, adOpenKeyset, adLockOptimistic, adCmdText
If Rs.RecordCount = 0 Then
If Me.txt_Fields(0).text <> "" And Me.txt_Fields(1).text <> "" And Me.txt_Fields(2).text <> "" And Me.txt_Fields(3).text <> "" And Trim(Me.Txt_Fields_Dustproof.text) <> "" Then
Cn.Execute "insert into Area_Customer (地区编码,地区名称,客户编码,客户名称,防尘垫要求) values ('" & Me.txt_Fields(0).text & "','" & Me.txt_Fields(1).text & "','" & Me.txt_Fields(2).text & "','" & Me.txt_Fields(3).text & "'," & Val(Me.Txt_Fields_Dustproof.text) & ")"
Frm_Customer_Riches.Tvw_Customer.Nodes.Clear
Call Frm_Customer_Riches.Tree_Change
Unload Me
Else
MsgBox "填写信息不完整,请检查。", vbCritical, "提示信息"
Exit Sub
End If
Else
MsgBox "此地区代码已重复!" + Chr(13) + "请重新输入!", vbCritical, "提示信息"
Exit Sub
End If
Rs.Close
Cn.Close
' Set Cn = New ADODB.Connection
' Cn.Open Cs
' Set Rs = New ADODB.Recordset
' Rs.Open "select * from Area_Customer where 地区编码 = '" & Left(AreaCustomer_Key, 2) & "' order by 客户编码", Cn, adOpenKeyset, adLockOptimistic, adCmdText
' If Rs.RecordCount > 0 Then '对地区代码/地区名/客户代码/赋值
' Rs.MoveLast
' Me.Txt_Fields(2).text = Rs!地区编码 & Format(Val(Right(Rs!客户编码, 3)) + 1, "000")
' Txt_Fields(3).text = ""
'' Txt_Fields(3).SetFocus
' End If
' Rs.Close
' Cn.Close
End If
End If
End If
'修改
If YN_Area_Customer_Add = False And YN_Area_Customer_Rename = True Then
'修改地区
If Len(AreaCustomer_Key) = 2 Then
Me.txt_Fields(0).text = Trim(Me.txt_Fields(0).text)
Me.txt_Fields(1).text = Trim(Me.txt_Fields(1).text)
Me.txt_Fields(2).text = Trim(Me.txt_Fields(2).text)
Me.txt_Fields(3).text = Trim(Me.txt_Fields(3).text)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -