📄 添加客户信息.frm
字号:
VERSION 5.00
Begin VB.Form frmAddKeHu
BorderStyle = 1 'Fixed Single
Caption = "添加客户信息..."
ClientHeight = 3975
ClientLeft = 45
ClientTop = 330
ClientWidth = 4155
Icon = "添加客户信息.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
ScaleHeight = 3975
ScaleWidth = 4155
Begin VB.Frame FramAddKeHu
Caption = "添加客户信息:"
ForeColor = &H00FF0000&
Height = 2535
Left = 120
TabIndex = 0
Top = 120
Width = 3855
Begin VB.TextBox TxtById
Appearance = 0 'Flat
ForeColor = &H000080FF&
Height = 270
Left = 1200
TabIndex = 1
Top = 315
Width = 1335
End
Begin VB.TextBox TxtByTel
Appearance = 0 'Flat
ForeColor = &H000080FF&
Height = 270
Left = 1200
TabIndex = 3
Top = 1177
Width = 1335
End
Begin VB.TextBox TxtCompany
Appearance = 0 'Flat
ForeColor = &H000080FF&
Height = 270
Left = 1200
TabIndex = 4
Top = 1575
Width = 1335
End
Begin VB.TextBox TxtByName
Appearance = 0 'Flat
ForeColor = &H000080FF&
Height = 270
Left = 1200
TabIndex = 2
Top = 746
Width = 1335
End
Begin VB.TextBox TxtEmail
Appearance = 0 'Flat
ForeColor = &H000080FF&
Height = 270
Left = 1200
TabIndex = 5
Top = 1995
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "取 消"
Height = 300
Left = 2760
TabIndex = 7
Top = 1980
Width = 800
End
Begin VB.CommandButton CmdOk
Caption = "确 定"
Height = 300
Left = 2760
TabIndex = 6
Top = 1560
Width = 800
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "客户编号:"
Height = 180
Left = 240
TabIndex = 19
Top = 360
Width = 900
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "客户姓名:"
Height = 180
Left = 240
TabIndex = 18
Top = 780
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "客户单位:"
Height = 180
Left = 240
TabIndex = 17
Top = 1620
Width = 900
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "客户电话:"
Height = 180
Left = 240
TabIndex = 16
Top = 1200
Width = 900
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "电子邮件:"
Height = 180
Left = 240
TabIndex = 15
Top = 2040
Width = 900
End
Begin VB.Image Image1
Height = 780
Left = 2880
Picture = "添加客户信息.frx":058A
Top = 360
Width = 780
End
End
Begin VB.Frame FramEdit
Caption = "修改客户信息:"
ForeColor = &H00FF0000&
Height = 2535
Left = 120
TabIndex = 20
Top = 120
Width = 3855
Begin VB.CommandButton CmdOkEd
Caption = "确 定"
Height = 300
Left = 2760
TabIndex = 13
Top = 1560
Width = 800
End
Begin VB.CommandButton CmdQuXiao
Caption = "取 消"
Height = 300
Left = 2760
TabIndex = 14
Top = 1980
Width = 800
End
Begin VB.TextBox TxtByEmailEd
Appearance = 0 'Flat
ForeColor = &H000080FF&
Height = 270
Left = 1200
TabIndex = 12
Top = 1995
Width = 1335
End
Begin VB.TextBox TxtByNameEd
Appearance = 0 'Flat
ForeColor = &H000080FF&
Height = 270
Left = 1200
TabIndex = 9
Top = 746
Width = 1335
End
Begin VB.TextBox TxtCompanyEd
Appearance = 0 'Flat
ForeColor = &H000080FF&
Height = 270
Left = 1200
TabIndex = 11
Top = 1560
Width = 1335
End
Begin VB.TextBox TxtByTelEd
Appearance = 0 'Flat
ForeColor = &H000080FF&
Height = 270
Left = 1200
TabIndex = 10
Top = 1177
Width = 1335
End
Begin VB.Label LabByIdEd
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
ForeColor = &H000080FF&
Height = 255
Left = 1200
TabIndex = 8
Top = 360
Width = 1335
End
Begin VB.Image Image2
Height = 780
Left = 2880
Picture = "添加客户信息.frx":14E3
Top = 360
Width = 780
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "电子邮件:"
Height = 180
Left = 240
TabIndex = 25
Top = 2040
Width = 900
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "客户电话:"
Height = 180
Left = 240
TabIndex = 24
Top = 1200
Width = 900
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "客户单位:"
Height = 180
Left = 240
TabIndex = 23
Top = 1620
Width = 900
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "客户姓名:"
Height = 180
Left = 240
TabIndex = 22
Top = 780
Width = 900
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "客户编号:"
Height = 180
Left = 240
TabIndex = 21
Top = 360
Width = 900
End
End
Begin VB.Label LabId
Caption = "Label11"
Height = 375
Left = 480
TabIndex = 26
Top = 3000
Width = 1215
End
End
Attribute VB_Name = "frmAddKeHu"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CmdOk_Click()
Dim n%
frmKeHu.Adodc1.CommandType = adCmdText
frmKeHu.Adodc1.RecordSource = "select * from kehu"
frmKeHu.Adodc1.Refresh
If TxtById = "" Then
MsgBox "请输入客户ID", vbOKOnly + vbExclamation, "提示"
Else
For n = 1 To frmKeHu.Adodc1.Recordset.RecordCount
If Val(TxtById) = frmKeHu.Adodc1.Recordset.Fields("buyer_id") Then
MsgBox "已经有" & Val(TxtById) & "这个编号的客户了,请重新输入", vbExclamation, "信息重复输入"
Exit Sub
Else
frmKeHu.Adodc1.Recordset.MoveNext
End If
Next n
frmKeHu.Adodc1.Recordset.AddNew
frmKeHu.Adodc1.Recordset.Fields("buyer_id") = TxtById
frmKeHu.Adodc1.Recordset.Fields("buyer_name") = TxtByName
frmKeHu.Adodc1.Recordset.Fields("buyer_company") = TxtCompany
frmKeHu.Adodc1.Recordset.Fields("buyer_tel") = Val(TxtByTel)
frmKeHu.Adodc1.Recordset.Fields("buyer_email") = TxtEmail
AddorEdit = "添加"
Unload Me
End If
End Sub
Private Sub CmdOkEd_Click()
frmKeHu.Adodc1.Recordset.Update
frmKeHu.Adodc1.Recordset.Fields("buyer_id") = LabByIdEd
frmKeHu.Adodc1.Recordset.Fields("buyer_name") = TxtByNameEd
frmKeHu.Adodc1.Recordset.Fields("buyer_company") = TxtCompanyEd
frmKeHu.Adodc1.Recordset.Fields("buyer_tel") = Val(TxtByTelEd)
frmKeHu.Adodc1.Recordset.Fields("buyer_email") = TxtByEmailEd
AddorEdit = "修改"
Unload Me
End Sub
Private Sub CmdQuXiao_Click()
Call Command2_Click
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
frmAddKeHu.Height = 3250
frmAddKeHu.Width = 4185
frmAddKeHu.Top = 1500
frmAddKeHu.Left = 3800
LabByIdEd = frmKeHu.Adodc1.Recordset.Fields("buyer_id")
TxtByNameEd = frmKeHu.Adodc1.Recordset.Fields("buyer_name")
TxtByTelEd = frmKeHu.Adodc1.Recordset.Fields("buyer_tel")
TxtCompanyEd = frmKeHu.Adodc1.Recordset.Fields("buyer_company")
TxtByEmailEd = frmKeHu.Adodc1.Recordset.Fields("buyer_email")
LabId = LabByIdEd
End Sub
Private Sub TxtById_KeyPress(KeyAscii As Integer)
Select Case Chr(KeyAscii)
Case "0" To "9", Chr(8), Chr(46)
Case Else
KeyAscii = 0
End Select
End Sub
Private Sub TxtByTel_KeyPress(KeyAscii As Integer)
Select Case Chr(KeyAscii)
Case "0" To "9", Chr(8), Chr(46)
Case Else
KeyAscii = 0
End Select
End Sub
Private Sub TxtByTelEd_KeyPress(KeyAscii As Integer)
Select Case Chr(KeyAscii)
Case "0" To "9", Chr(8), Chr(46)
Case Else
KeyAscii = 0
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -