📄 frmcltedit.frm
字号:
VERSION 5.00
Begin VB.Form FrmCltEdit
BorderStyle = 1 'Fixed Single
Caption = "客户信息编辑"
ClientHeight = 3720
ClientLeft = 45
ClientTop = 330
ClientWidth = 6495
Icon = "FrmCltEdit.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3720
ScaleWidth = 6495
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Height = 2775
Left = 240
TabIndex = 10
Top = 120
Width = 6015
Begin VB.TextBox txtDescribe
Height = 735
Left = 1320
MaxLength = 100
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 7
Top = 1920
Width = 4455
End
Begin VB.TextBox txtFax
Height = 270
Left = 4320
MaxLength = 20
TabIndex = 6
Top = 1476
Width = 1455
End
Begin VB.TextBox txtPhone
Height = 270
Left = 1320
MaxLength = 200
TabIndex = 5
Top = 1476
Width = 1455
End
Begin VB.TextBox txtContact
Height = 270
Left = 4320
MaxLength = 20
TabIndex = 2
Top = 622
Width = 1455
End
Begin VB.ComboBox ComboType
Height = 300
ItemData = "FrmCltEdit.frx":0CCA
Left = 1320
List = "FrmCltEdit.frx":0CD4
Style = 2 'Dropdown List
TabIndex = 1
Top = 607
Width = 1455
End
Begin VB.TextBox txtOrg
Height = 270
Left = 1320
MaxLength = 100
TabIndex = 0
Top = 210
Width = 4455
End
Begin VB.TextBox txtAddr
Height = 270
Left = 1320
MaxLength = 200
TabIndex = 3
Top = 1049
Width = 1455
End
Begin VB.TextBox txtCode
Height = 270
Left = 4320
MaxLength = 20
TabIndex = 4
Top = 1049
Width = 1455
End
Begin VB.Label Label7
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "描述信息"
Height = 180
Left = 240
TabIndex = 18
Top = 1950
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "传真电话"
Height = 180
Left = 3240
TabIndex = 17
Top = 1521
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "联系电话"
Height = 180
Left = 240
TabIndex = 16
Top = 1521
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "联系人"
Height = 180
Left = 3240
TabIndex = 15
Top = 667
Width = 540
End
Begin VB.Label Label8
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "客户类别"
Height = 180
Left = 240
TabIndex = 14
Top = 667
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "客户单位"
Height = 180
Left = 240
TabIndex = 13
Top = 240
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "通信地址"
Height = 180
Left = 240
TabIndex = 12
Top = 1094
Width = 720
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "邮政编码"
Height = 180
Left = 3240
TabIndex = 11
Top = 1094
Width = 720
End
End
Begin VB.CommandButton Cmd_OK
Caption = "确 定"
Height = 400
Left = 1517
MouseIcon = "FrmCltEdit.frx":0CE8
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 8
Top = 3120
Width = 1300
End
Begin VB.CommandButton Cmd_Cancel
Cancel = -1 'True
Caption = "取 消"
Height = 400
Left = 3677
MouseIcon = "FrmCltEdit.frx":0FF2
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 9
Top = 3120
Width = 1300
End
End
Attribute VB_Name = "FrmCltEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean
Public OriId As Long
Public OriName As String
Private Sub Cmd_OK_Click()
'检查录入数据的有效性
If Trim(txtOrg) = "" Then
MsgBox "请输入客户单位"
txtOrg.SetFocus
Exit Sub
End If
'把用户录入的数据赋值到对象MyClt中
With MyClt
.ClientName = MakeStr(txtOrg)
.ClientType = ComboType.ListIndex + 1
.Contact = MakeStr(txtContact)
.Address = MakeStr(txtAddr)
.Postcode = MakeStr(txtCode)
.Phone = MakeStr(txtPhone)
.Fax = MakeStr(txtFax)
.Describe = MakeStr(txtDescribe)
'判断客户名称是否存在
If Modify = False Or OriName <> Trim(txtOrg) Then
If .In_DB(MakeStr(txtOrg)) = True Then
MsgBox "客户单位已经存在,请重新输入"
txtOrg.SetFocus
txtOrg.SelStart = 0
txtOrg.SelLength = Len(txtOrg)
Exit Sub
End If
End If
'根据变量Modify决定是插入新记录,还是修改记录
'调用Update()函数的参数OriId表示当前编辑的客户编号
If Modify = False Then
.Insert
Else
.Update (OriId)
End If
End With
'关闭窗体
Unload Me
End Sub
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub txtContact_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtDescribe_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtFax_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtOrg_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtAddr_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtCode_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
If In_Int(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
Private Sub txtPhone_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -