📄 frmcustomeredit.frm
字号:
Height = 1095
Left = 120
TabIndex = 0
Top = 600
Width = 9855
Begin VB.TextBox txtEmail
Height = 300
Left = 8280
TabIndex = 35
Top = 720
Width = 1335
End
Begin VB.ComboBox cob_Sex
Height = 300
Left = 2760
TabIndex = 28
Top = 300
Width = 735
End
Begin VB.TextBox txtZipCode
Height = 270
Left = 6600
TabIndex = 25
Top = 735
Width = 855
End
Begin VB.TextBox txtAddress
Height = 270
Left = 3600
TabIndex = 24
Top = 735
Width = 2175
End
Begin VB.TextBox txtTelephone
Height = 300
Left = 8280
TabIndex = 11
Top = 360
Width = 1335
End
Begin VB.TextBox txtIdCard
Height = 300
Left = 5760
TabIndex = 9
Top = 300
Width = 1935
End
Begin VB.TextBox txtWorkorg
Height = 300
Left = 960
TabIndex = 7
Top = 720
Width = 1935
End
Begin VB.TextBox txtAge
Height = 300
Left = 4200
TabIndex = 4
Top = 300
Width = 495
End
Begin VB.TextBox txtName
Height = 300
Left = 720
TabIndex = 2
Top = 300
Width = 1095
End
Begin VB.Label Label16
AutoSize = -1 'True
Caption = "Email"
Height = 180
Left = 7680
TabIndex = 36
Top = 780
Width = 450
End
Begin VB.Label Label28
AutoSize = -1 'True
Caption = "邮编"
Height = 180
Left = 6120
TabIndex = 23
Top = 780
Width = 360
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "地址"
Height = 180
Left = 3120
TabIndex = 12
Top = 780
Width = 360
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "电话"
Height = 180
Left = 7800
TabIndex = 10
Top = 360
Width = 360
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "身份证号"
Height = 180
Left = 4920
TabIndex = 8
Top = 360
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "工作单位"
Height = 180
Left = 120
TabIndex = 6
Top = 780
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "性别"
Height = 180
Left = 2280
TabIndex = 5
Top = 360
Width = 360
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "年龄"
Height = 180
Left = 3720
TabIndex = 3
Top = 360
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "姓名"
Height = 180
Left = 120
TabIndex = 1
Top = 360
Width = 360
End
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "客户编号"
Height = 180
Left = 240
TabIndex = 44
Top = 240
Width = 720
End
End
Attribute VB_Name = "FrmCustomerEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean '插入=false,修改=true
Public OriId As String '客户编号
Public IsMember As Boolean '是否为会员,true:是;false:否
Private Sub Cmd_Exit_Click()
Unload Me
End Sub
Private Sub Cmd_OK_Click()
'检查用户录入数据的有效性
If Len(Trim(txtId)) = 0 Then
MsgBox ("请输入客户编号")
txtId.SetFocus
Exit Sub
End If
If Len(Trim(txtName)) = 0 Then
MsgBox "请输入驾驶员姓名"
txtName.SetFocus
Exit Sub
End If
If Len(Trim(txtAge)) = 0 Then
MsgBox "请输入年龄"
txtAge.SetFocus
Exit Sub
End If
If Len(Trim(txtIdCard)) = 0 Then
MsgBox "请输入身份证号"
txtIdCard.SetFocus
Exit Sub
End If
If Len(Trim(txtTelephone)) = 0 Then
MsgBox "请输入联系电话"
txtTelephone.SetFocus
Exit Sub
End If
If Len(Trim(txtLNo)) = 0 Then
MsgBox "请输入驾驶证号"
txtLNo.SetFocus
Exit Sub
End If
If Len(Trim(cob_LType.Text)) = 0 Then
MsgBox "请选择驾驶证类别"
cob_LType.SetFocus
Exit Sub
End If
If Len(Trim(cob_Cert.Text)) = 0 Then
MsgBox "请选择抵押证件名称"
cob_Cert.SetFocus
Exit Sub
End If
If Len(Trim(txtWName)) = 0 Then
MsgBox "请输入担保人姓名"
txtWName.SetFocus
Exit Sub
End If
If Len(Trim(txtWIdCard)) = 0 Then
MsgBox "请输入担保人身份证号"
txtWIdCard.SetFocus
Exit Sub
End If
'把用户录入的数据赋值到数据库对象变量中
With MyCustomer
.Id = MakeStr(txtId)
.Name = MakeStr(txtName)
.Age = Val(txtAge)
.Sex = MakeStr(cob_Sex.Text)
.IdCard = MakeStr(txtIdCard)
.Telephone = MakeStr(txtTelephone)
.Workorg = MakeStr(txtWorkorg)
.ZipCode = MakeStr(txtZipCode)
.Address = MakeStr(txtAddress)
.Email = MakeStr(txtEmail)
.LicenseNo = MakeStr(txtLNo)
.LicenseType = MakeStr(cob_LType.Text)
.GetDate = MakeStr(txtGetDate)
.ExpiredDate = MakeStr(txtExpiredDate)
.DriverAge = Val(txtDriverAge)
.Certificate = MakeStr(cob_Cert.Text)
.Warrantor = MakeStr(txtWName)
.WIdCard = MakeStr(txtWIdCard)
'根据变量Modify的值,决定是插入新数据,还是修改已有的数据
If Modify = False Then
'判断此客户编号是否存在
If .In_DB(Trim(txtId)) = True Then
MsgBox ("已经存在此客户编号")
txtId.SetFocus
Exit Sub
End If
.Insert
Else
'判断是否为会员
If IsMember = False Then
.TypeId = 0
.Flag = 0
Call .Update(OriId)
Else '是会员,判断是否选择了会员类型
If Len(Trim(dco_MemType.Text)) = 0 Then
MsgBox ("请选择会员类型")
dco_MemType.SetFocus
Exit Sub
End If
.TypeId = Val(dco_MemType.BoundText) '设置会员类型编号
.Flag = 1
Call .Update(OriId)
End If
End If
End With
'关闭窗口
Unload Me
End Sub
Private Sub dco_MemType_Click(Area As Integer)
'选择会员类别后,将折扣数据录入
If Len(Trim(dco_MemType.BoundText)) = 0 Then
Exit Sub
End If
If MyMemberType.GetInfo(dco_MemType.BoundText) = True Then
txtRate = Format(MyMemberType.Rate, "0.##") '按照指定格式显示享受折扣
Else
txtRate = 1 '如果没有此会员类型则折扣为1,即不享受折扣
End If
End Sub
Private Sub Form_Load()
DataSetup
End Sub
Private Sub DataSetup()
Adodc1.ConnectionString = conn '设置数据库连接字符串
Adodc1.RecordSource = "SELECT * FROM MemberType ORDER BY Id"
Adodc1.Refresh
Set dco_MemType.RowSource = Adodc1 '设置数据源
dco_MemType.ListField = "TypeName" '设置显示字段
dco_MemType.BoundColumn = "Id" '设置绑定字段
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -