📄 frmcustedit.frm
字号:
VERSION 5.00
Begin VB.Form FrmCustEdit
BorderStyle = 1 'Fixed Single
Caption = "编辑客户信息"
ClientHeight = 4170
ClientLeft = 45
ClientTop = 330
ClientWidth = 5655
Icon = "FrmCustEdit.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4170
ScaleWidth = 5655
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Cmd_Cancel
Caption = "取 消"
Height = 495
Left = 4440
TabIndex = 29
Top = 3480
Width = 1095
End
Begin VB.CommandButton Cmd_OK
Caption = "确 定"
Height = 495
Left = 3120
TabIndex = 28
Top = 3480
Width = 1095
End
Begin VB.Frame Frame2
Height = 3135
Left = 120
TabIndex = 1
Top = 120
Width = 5415
Begin VB.TextBox txtFrom
Height = 270
Left = 3240
MaxLength = 25
TabIndex = 7
Top = 1035
Width = 2055
End
Begin VB.OptionButton Option2
Caption = "女"
Height = 255
Left = 4320
TabIndex = 5
Top = 623
Width = 735
End
Begin VB.OptionButton Option1
Caption = "男"
Height = 255
Left = 3240
TabIndex = 4
Top = 623
Width = 735
End
Begin VB.ComboBox ComboLevel
Height = 300
ItemData = "FrmCustEdit.frx":0CCA
Left = 960
List = "FrmCustEdit.frx":0CD4
Style = 2 'Dropdown List
TabIndex = 6
Top = 1020
Width = 1095
End
Begin VB.ComboBox ComboIdtype
Height = 300
ItemData = "FrmCustEdit.frx":0CEC
Left = 960
List = "FrmCustEdit.frx":0D05
Style = 2 'Dropdown List
TabIndex = 8
Top = 1440
Width = 1095
End
Begin VB.ComboBox ComboCustType
Height = 300
ItemData = "FrmCustEdit.frx":0D3F
Left = 960
List = "FrmCustEdit.frx":0D4C
TabIndex = 0
Text = "散客"
Top = 180
Width = 1095
End
Begin VB.TextBox txtCustId
Height = 270
Left = 3240
MaxLength = 20
TabIndex = 9
Top = 1455
Width = 2055
End
Begin VB.TextBox txtOrgName
Height = 270
Left = 3240
MaxLength = 50
TabIndex = 2
Top = 195
Width = 2055
End
Begin VB.TextBox txtName
Height = 270
Left = 960
MaxLength = 25
TabIndex = 3
Top = 615
Width = 1095
End
Begin VB.TextBox txtAddr
Height = 270
Left = 3240
MaxLength = 100
TabIndex = 11
Top = 1875
Width = 2055
End
Begin VB.TextBox txtOffice
Height = 270
Left = 960
MaxLength = 15
TabIndex = 12
Top = 2295
Width = 1095
End
Begin VB.TextBox txtMobile
Height = 270
Left = 3240
MaxLength = 15
TabIndex = 13
Top = 2295
Width = 2055
End
Begin VB.TextBox txtHome
Height = 270
Left = 960
MaxLength = 15
TabIndex = 14
Top = 2715
Width = 1095
End
Begin VB.TextBox txtPostcode
Height = 270
Left = 960
MaxLength = 20
TabIndex = 10
Top = 1875
Width = 1095
End
Begin VB.TextBox txtJob
Height = 270
Left = 3240
MaxLength = 25
TabIndex = 15
Top = 2715
Width = 2055
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "国籍户籍"
Height = 180
Left = 2400
TabIndex = 30
Top = 1080
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "客户等级"
Height = 180
Left = 120
TabIndex = 27
Top = 1080
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "证件类型"
Height = 180
Left = 120
TabIndex = 26
Top = 1500
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "客户类别"
Height = 180
Left = 120
TabIndex = 25
Top = 240
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "证件编号"
Height = 180
Left = 2400
TabIndex = 24
Top = 1500
Width = 720
End
Begin VB.Label Label31
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "职 务"
Height = 180
Left = 2400
TabIndex = 23
Top = 2760
Width = 450
End
Begin VB.Label Label33
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "通信地址"
Height = 180
Left = 2400
TabIndex = 22
Top = 1920
Width = 720
End
Begin VB.Label Label37
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "手机电话"
Height = 180
Left = 2400
TabIndex = 21
Top = 2340
Width = 720
End
Begin VB.Label Label39
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "邮政编码"
Height = 180
Left = 120
TabIndex = 20
Top = 1920
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "客户单位"
Height = 180
Left = 2400
TabIndex = 19
Top = 240
Width = 720
End
Begin VB.Label Label9
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "客户姓名"
Height = 180
Left = 120
TabIndex = 18
Top = 660
Width = 720
End
Begin VB.Label Label35
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "单位电话"
Height = 180
Left = 120
TabIndex = 17
Top = 2340
Width = 720
End
Begin VB.Label Label38
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "住宅电话"
Height = 180
Left = 120
TabIndex = 16
Top = 2760
Width = 720
End
End
End
Attribute VB_Name = "FrmCustEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public OriCustId As String '修改状态时,客户记录中原有的证件编号。这是此记录的标识
Public Modify As Boolean
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Cmd_OK_Click()
'检查用户录入的数据是否完全有效
'客户类别、客户姓名、证件编号是必须输入的
If Trim(ComboCustType.Text) = "" Then
MsgBox "请输入客户类别"
ComboCustType.SetFocus
Exit Sub
End If
If Trim(txtName) = "" Then
MsgBox "请输入客户姓名"
txtName.SetFocus
Exit Sub
End If
If Trim(txtCustId) = "" Then
MsgBox "请输入证件编号"
txtCustId.SetFocus
Exit Sub
End If
If Len(Trim(ComboCustType.Text)) > 25 Then
MsgBox "客户类别字符超长,请重新录入"
Exit Sub
End If
'把用户录入的数据赋值到MyCust对象中,并保存到数据库
With MyCust
.CustType = MakeStr(ComboCustType.Text) '==客户类别
.OrgName = MakeStr(txtOrgName) '==工作单位
.CustName = MakeStr(txtName) '==客户姓名
If Option1.Value = True Then '==性别
.Sex = "男"
Else
.Sex = "女"
End If
.CustLevel = ComboLevel.Text '客户等级
.CustFrom = MakeStr(txtFrom) '国籍户籍
.Idtype = ComboIdtype.Text '证件类型
.CustId = MakeStr(txtCustId) '证件编号
.Postcode = MakeStr(txtPostcode) '邮政编码
.Address = MakeStr(txtAddr) '通信地址
.Office = MakeStr(txtOffice) '单位电话
.Mobile = MakeStr(txtMobile) '移动电话
.Home = MakeStr(txtHome) '家庭电话
.Job = MakeStr(txtJob) '职务
'Modify=False表示当前为插入新数据状态;否则为修改数据状态
If Modify = False Then
'判断当前用户是否存在
If .In_DB(.CustId) = True Then
MsgBox "当前客户已经存在"
Exit Sub
End If
.Insert
Else
If .CustId <> OriCustId Then
'判断当前客户是否存在
If .In_DB(.CustId) = True Then
MsgBox "当前客户已经存在"
Exit Sub
End If
End If
.Update (OriCustId)
End If
End With
Unload Me
End Sub
Private Sub Form_Load()
Dim i As Integer
'读取客户类别到数组Arr_CustType()中
MyCust.Loadtype
ComboCustType.Clear
'依次把数组Arr_CustType()中的数据添加到ComboType组合框中
i = 0
Do While Arr_CustType(i) <> ""
ComboCustType.AddItem Arr_CustType(i)
i = i + 1
Loop
End Sub
Private Sub txtPostcode_KeyPress(KeyAscii As Integer)
If In_Int(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -