?? frmcustedit.frm
字號:
VERSION 5.00
Begin VB.Form FrmCustEdit
Caption = "編輯客戶信息"
ClientHeight = 4200
ClientLeft = 60
ClientTop = 450
ClientWidth = 5445
LinkTopic = "Form3"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4200
ScaleWidth = 5445
Begin VB.Frame Frame2
Height = 3135
Left = 0
TabIndex = 2
Top = 0
Width = 5415
Begin VB.TextBox txtJob
Height = 270
Left = 3240
MaxLength = 25
TabIndex = 17
Top = 2715
Width = 2055
End
Begin VB.TextBox txtPostcode
Height = 270
Left = 960
MaxLength = 20
TabIndex = 16
Top = 1875
Width = 1095
End
Begin VB.TextBox txtHome
Height = 270
Left = 960
MaxLength = 15
TabIndex = 15
Top = 2715
Width = 1095
End
Begin VB.TextBox txtMobile
Height = 270
Left = 3240
MaxLength = 15
TabIndex = 14
Top = 2295
Width = 2055
End
Begin VB.TextBox txtOffice
Height = 270
Left = 960
MaxLength = 15
TabIndex = 13
Top = 2295
Width = 1095
End
Begin VB.TextBox txtAddr
Height = 270
Left = 3240
MaxLength = 100
TabIndex = 12
Top = 1875
Width = 2055
End
Begin VB.TextBox txtName
Height = 270
Left = 960
MaxLength = 25
TabIndex = 11
Top = 615
Width = 1095
End
Begin VB.TextBox txtOrgName
Height = 270
Left = 3240
MaxLength = 50
TabIndex = 10
Top = 195
Width = 2055
End
Begin VB.TextBox txtCustId
Height = 270
Left = 3240
MaxLength = 20
TabIndex = 9
Top = 1455
Width = 2055
End
Begin VB.ComboBox ComboCustType
Height = 300
ItemData = "FrmCustEdit.frx":0000
Left = 960
List = "FrmCustEdit.frx":000D
TabIndex = 8
Text = "散客"
Top = 180
Width = 1095
End
Begin VB.ComboBox ComboIdtype
Height = 300
ItemData = "FrmCustEdit.frx":0023
Left = 960
List = "FrmCustEdit.frx":003C
Style = 2 'Dropdown List
TabIndex = 7
Top = 1440
Width = 1095
End
Begin VB.ComboBox ComboLevel
Height = 300
ItemData = "FrmCustEdit.frx":0076
Left = 960
List = "FrmCustEdit.frx":0080
Style = 2 'Dropdown List
TabIndex = 6
Top = 1020
Width = 1095
End
Begin VB.OptionButton Option1
Caption = "男"
Height = 255
Left = 3240
TabIndex = 5
Top = 623
Width = 735
End
Begin VB.OptionButton Option2
Caption = "女"
Height = 255
Left = 4320
TabIndex = 4
Top = 623
Width = 735
End
Begin VB.TextBox txtFrom
Height = 270
Left = 3240
MaxLength = 25
TabIndex = 3
Top = 1035
Width = 2055
End
Begin VB.Label Label7
Caption = "性別"
Height = 255
Left = 2520
TabIndex = 31
Top = 720
Width = 615
End
Begin VB.Label Label38
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "住宅電話"
Height = 180
Left = 120
TabIndex = 30
Top = 2760
Width = 720
End
Begin VB.Label Label35
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "單位電話"
Height = 180
Left = 120
TabIndex = 29
Top = 2340
Width = 720
End
Begin VB.Label Label9
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "客戶姓名"
Height = 180
Left = 120
TabIndex = 28
Top = 660
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "客戶單位"
Height = 180
Left = 2400
TabIndex = 27
Top = 240
Width = 720
End
Begin VB.Label Label39
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "郵政編碼"
Height = 180
Left = 120
TabIndex = 26
Top = 1920
Width = 720
End
Begin VB.Label Label37
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "手機電話"
Height = 180
Left = 2400
TabIndex = 25
Top = 2340
Width = 720
End
Begin VB.Label Label33
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "通信地址"
Height = 180
Left = 2400
TabIndex = 24
Top = 1920
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 Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "證件編號"
Height = 180
Left = 2400
TabIndex = 22
Top = 1500
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "客戶類別"
Height = 180
Left = 120
TabIndex = 21
Top = 240
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "證件類型"
Height = 180
Left = 120
TabIndex = 20
Top = 1500
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "客戶等級"
Height = 180
Left = 120
TabIndex = 19
Top = 1080
Width = 720
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "國籍戶籍"
Height = 180
Left = 2400
TabIndex = 18
Top = 1080
Width = 720
End
End
Begin VB.CommandButton Cmd_OK
Caption = "確 定"
Height = 495
Left = 3000
TabIndex = 1
Top = 3360
Width = 1095
End
Begin VB.CommandButton Cmd_Cancel
Caption = "取 消"
Height = 495
Left = 4320
TabIndex = 0
Top = 3360
Width = 1095
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 + -