📄 frmaddcustomer.frm
字号:
VERSION 5.00
Begin VB.Form frmAddCustomer
BorderStyle = 1 'Fixed Single
Caption = "添加客户信息"
ClientHeight = 5280
ClientLeft = 45
ClientTop = 330
ClientWidth = 7920
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 5280
ScaleWidth = 7920
Begin VB.TextBox txtFields
Height = 375
Index = 13
Left = 5160
TabIndex = 29
Top = 3960
Width = 2535
End
Begin VB.CommandButton updateCommand
Caption = "保存记录"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 2160
TabIndex = 27
Top = 4560
Width = 1095
End
Begin VB.CommandButton cancelCommand
Caption = "关闭退出"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 5520
TabIndex = 26
Top = 4560
Width = 1215
End
Begin VB.TextBox txtFields
Height = 375
Index = 12
Left = 1680
TabIndex = 25
Top = 3960
Width = 2055
End
Begin VB.TextBox txtFields
Height = 375
Index = 11
Left = 5160
TabIndex = 23
Top = 3360
Width = 2535
End
Begin VB.TextBox txtFields
Height = 375
Index = 10
Left = 1680
TabIndex = 21
Top = 3360
Width = 2055
End
Begin VB.TextBox txtFields
Height = 375
Index = 9
Left = 5160
TabIndex = 19
Top = 2760
Width = 2535
End
Begin VB.TextBox txtFields
Height = 375
Index = 8
Left = 1680
TabIndex = 17
Top = 2760
Width = 2055
End
Begin VB.TextBox txtFields
Height = 375
Index = 7
Left = 5160
TabIndex = 15
Top = 2160
Width = 2535
End
Begin VB.TextBox txtFields
Height = 375
Index = 6
Left = 1680
TabIndex = 13
Top = 2160
Width = 2055
End
Begin VB.TextBox txtFields
Height = 375
Index = 5
Left = 5160
TabIndex = 11
Top = 1560
Width = 2535
End
Begin VB.TextBox txtFields
Height = 375
Index = 4
Left = 1680
TabIndex = 9
Top = 1560
Width = 2055
End
Begin VB.TextBox txtFields
Height = 375
Index = 3
Left = 5160
TabIndex = 7
Top = 960
Width = 2535
End
Begin VB.TextBox txtFields
Height = 375
Index = 2
Left = 1680
TabIndex = 5
Top = 960
Width = 2055
End
Begin VB.TextBox txtFields
Height = 375
Index = 1
Left = 5160
TabIndex = 3
Top = 360
Width = 2535
End
Begin VB.TextBox txtFields
Height = 375
Index = 0
Left = 1680
TabIndex = 1
Top = 360
Width = 2055
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "备注:"
Height = 180
Index = 13
Left = 4080
TabIndex = 28
Top = 4080
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "需求房型:"
Height = 180
Index = 12
Left = 360
TabIndex = 24
Top = 4080
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "需求楼层:"
Height = 180
Index = 11
Left = 4080
TabIndex = 22
Top = 3480
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "需求面积:"
Height = 180
Index = 10
Left = 360
TabIndex = 20
Top = 3460
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "联系电话:"
Height = 180
Index = 9
Left = 4080
TabIndex = 18
Top = 2880
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "联系地址:"
Height = 180
Index = 8
Left = 360
TabIndex = 16
Top = 2840
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "邮编:"
Height = 180
Index = 7
Left = 4080
TabIndex = 14
Top = 2280
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "身份证:"
Height = 180
Index = 6
Left = 360
TabIndex = 12
Top = 2220
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "工作单位:"
Height = 180
Index = 5
Left = 4080
TabIndex = 10
Top = 1680
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "职业:"
Height = 180
Index = 4
Left = 360
TabIndex = 8
Top = 1600
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "年龄:"
Height = 180
Index = 3
Left = 4080
TabIndex = 6
Top = 1080
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "性别:"
Height = 180
Index = 2
Left = 360
TabIndex = 4
Top = 980
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "客户名称:"
Height = 180
Index = 1
Left = 4080
TabIndex = 2
Top = 480
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "客户编号:"
Height = 180
Index = 0
Left = 360
TabIndex = 0
Top = 360
Width = 900
End
End
Attribute VB_Name = "frmAddCustomer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cancelCommand_Click()
Unload Me
End Sub
Private Sub txtfields_LostFocus(Index As Integer)
Dim pTitle As String
pTitle = "信息框"
If Not IsNumeric(txtfields(3).Text) And (txtfields(3).Text <> "") Then
MsgBox "请在“年龄”中输入数字", vbExclamation + vbOKOnly, pTitle
txtfields(3).SetFocus
txtfields(3).SelLength = Len(txtfields(1))
txtfields(3).SelStart = 0
End If
If Not IsNumeric(txtfields(6).Text) And (txtfields(6).Text <> "") Then
MsgBox "请在“身份证”中输入数字", vbExclamation + vbOKOnly, pTitle
txtfields(6).SetFocus
txtfields(6).SelLength = Len(txtfields(6))
txtfields(6).SelStart = 0
End If
If Not IsNumeric(txtfields(7).Text) And (txtfields(7).Text <> "") Then
MsgBox "请在“邮编”中输入数字", vbExclamation + vbOKOnly, pTitle
txtfields(7).SetFocus
txtfields(7).SelLength = Len(txtfields(7))
txtfields(7).SelStart = 0
End If
If Not IsNumeric(txtfields(10).Text) And (txtfields(10).Text <> "") Then
MsgBox "请在“需求面积”中输入数字", vbExclamation + vbOKOnly, pTitle
txtfields(10).SetFocus
txtfields(10).SelLength = Len(txtfields(10))
txtfields(10).SelStart = 0
End If
If Not IsNumeric(txtfields(11).Text) And (txtfields(11).Text <> "") Then
MsgBox "请在“需求房层”中输入数字", vbExclamation + vbOKOnly, pTitle
txtfields(11).SetFocus
txtfields(11).SelLength = Len(txtfields(11))
txtfields(11).SelStart = 0
End If
End Sub
Private Sub updateCommand_Click()
Dim txtSQL As String
Dim MsgText As String
Dim mrcc As ADODB.Recordset
If Not Testtxt(txtfields(0).Text) Then
MsgBox "请输入客户编号!", vbOKOnly + vbExclamation, "警告"
txtfields(0).SetFocus
Exit Sub
End If
If Not Testtxt(txtfields(1).Text) Then
MsgBox "请输入客户名称!", vbOKOnly + vbExclamation, "警告"
txtfields(1).SetFocus
Exit Sub
End If
txtSQL = "select * from 客户信息 where 客户编号 = '" & Trim(txtfields(0).Text) & "'"
Set mrcc = ExecuteSQL(txtSQL, MsgText)
If mrcc.EOF = False Then
MsgBox "客户编号重复,请重新输入!", vbOKOnly + vbExclamation, "警告"
mrcc.Close
txtfields(0).SetFocus
Else
mrcc.AddNew
mrcc.Fields(0) = Trim(txtfields(0).Text)
mrcc.Fields(1) = Trim(txtfields(1).Text)
mrcc.Fields(2) = Trim(txtfields(2).Text)
mrcc.Fields(3) = Val(txtfields(3).Text)
mrcc.Fields(4) = Trim(txtfields(4).Text)
mrcc.Fields(5) = Trim(txtfields(5).Text)
mrcc.Fields(6) = Val(txtfields(6).Text)
mrcc.Fields(7) = Val(txtfields(7).Text)
mrcc.Fields(8) = Trim(txtfields(8).Text)
mrcc.Fields(9) = Trim(txtfields(9).Text)
mrcc.Fields(10) = Val(txtfields(10).Text)
mrcc.Fields(11) = Val(txtfields(11).Text)
mrcc.Fields(12) = Trim(txtfields(12).Text)
mrcc.Fields(13) = Trim(txtfields(13).Text)
mrcc.Update
MsgBox "客户信息添加成功!", vbOKOnly + vbExclamation, "添加客户信息"
mrcc.Close
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -