📄 contact_input.frm
字号:
VERSION 5.00
Begin VB.Form Contact_input
Caption = "客户联系信息"
ClientHeight = 4815
ClientLeft = 60
ClientTop = 450
ClientWidth = 8535
LinkTopic = "Form1"
ScaleHeight = 4815
ScaleWidth = 8535
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 495
Left = 7080
TabIndex = 16
Top = 4200
Width = 1215
End
Begin VB.CommandButton cmdOK
Caption = "确认"
Height = 495
Left = 5880
TabIndex = 15
Top = 4200
Width = 1215
End
Begin VB.Frame Frame1
Caption = "客户联系信息"
Height = 3975
Left = 120
TabIndex = 0
Top = 120
Width = 8295
Begin VB.TextBox Xclxsj
Height = 375
Left = 1200
TabIndex = 18
Top = 3360
Width = 1200
End
Begin VB.TextBox Fkxx
Height = 750
Left = 240
MultiLine = -1 'True
TabIndex = 14
Top = 2520
Width = 7935
End
Begin VB.TextBox Lxnr
Height = 750
Left = 240
MultiLine = -1 'True
TabIndex = 13
Top = 1440
Width = 7935
End
Begin VB.ComboBox Lxxz
Height = 300
Left = 6600
Style = 2 'Dropdown List
TabIndex = 12
Top = 720
Width = 1560
End
Begin VB.ComboBox Lxfs
Height = 300
Left = 3750
Style = 2 'Dropdown List
TabIndex = 11
Top = 720
Width = 1560
End
Begin VB.TextBox Lxrq
Height = 375
Left = 1200
TabIndex = 10
Top = 720
Width = 1200
End
Begin VB.Label Label8
Alignment = 2 'Center
Caption = "下次联系时间"
Height = 375
Left = 240
TabIndex = 17
Top = 3360
Width = 840
End
Begin VB.Label khmc
Caption = "客户名称"
Height = 255
Left = 3750
TabIndex = 9
Top = 360
Width = 4305
End
Begin VB.Label khbh
Caption = "客户编号"
Height = 255
Left = 1200
TabIndex = 8
Top = 360
Width = 975
End
Begin VB.Label Label7
Caption = "联系性质"
Height = 255
Left = 5600
TabIndex = 7
Top = 750
Width = 795
End
Begin VB.Label Label6
Caption = "联系方式"
Height = 255
Left = 2800
TabIndex = 6
Top = 750
Width = 795
End
Begin VB.Label Label5
Caption = "反馈信息"
Height = 255
Left = 240
TabIndex = 5
Top = 2280
Width = 795
End
Begin VB.Label Label4
Caption = "联系内容"
Height = 255
Left = 240
TabIndex = 4
Top = 1200
Width = 795
End
Begin VB.Label Label3
Caption = "联系日期"
Height = 255
Left = 240
TabIndex = 3
Top = 750
Width = 795
End
Begin VB.Label Label2
Caption = "客户名称"
Height = 255
Left = 2800
TabIndex = 2
Top = 360
Width = 795
End
Begin VB.Label Label1
Caption = "客户编号"
Height = 255
Left = 240
TabIndex = 1
Top = 360
Width = 800
End
End
End
Attribute VB_Name = "Contact_input"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private ListRS As New ADODB.Recordset
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim Sqlstring As String
Sqlstring = ""
Select Case OperateState
Case "add"
Sqlstring = "insert into Contact_DATA (客户编号,联系日期,联系内容,反馈信息,联系方式,联系性质,下次联系时间) values(" _
& ClientCode & ",'" & Lxrq.Text & "','" & Lxnr.Text & "','" & Fkxx.Text & "','" & Lxfs.Text & "','" & Lxxz.Text & "','" & Xclxsj.Text & "')"
'Sqlstring = "insert into Client_BASE (客户名称) values('aaa')"
If Lxrq.Text <> "" Then
MainDB.Execute (Sqlstring)
MainDB.Execute ("update Client_BASE set 最后联系时间='" & Lxrq.Text & "',下次联系时间='" & Xclxsj.Text & "' where 客户编号=" & ClientCode)
Unload Me
Else
MsgBox "请输入联系日期", vbExclamation, "警告"
End If
Case "modify"
Sqlstring = "update Contact_DATA set " _
& "联系日期='" & Lxrq.Text & "'," _
& "联系内容='" & Lxnr.Text & "'," _
& "反馈信息='" & Fkxx.Text & "'," _
& "联系方式='" & Lxfs.Text & "'," _
& "联系性质='" & Lxxz.Text & "'," _
& "下次联系时间='" & Xclxsj.Text & "'" _
& " where 客户编号=" & ClientCode & " and 数据编号=" & DataCode
If ClientCode > 0 Then
MainDB.Execute (Sqlstring)
MainDB.Execute ("update Client_BASE set 最后联系时间='" & Lxrq.Text & "',下次联系时间='" & Xclxsj.Text & "' where 客户编号=" & ClientCode)
Unload Me
End If
End Select
Set MainRS = Nothing
MainRS.Open "select * from " & OperateDB & " where 客户编号=" & ClientCode, MainDB, adOpenStatic, adLockOptimistic
Set Data_list.Adodc1.Recordset = MainRS
End Sub
Private Sub Form_Load()
Lxrq.Text = Date
Xclxsj.Text = Date
khbh.Caption = ClientCode
khmc.Caption = ClientName
Set ListRS = Nothing
ListRS.Open "select * from JC_LXFS", MainDB, adOpenStatic, adLockOptimistic
While Not ListRS.EOF
Lxfs.AddItem ListRS!联系方式
ListRS.MoveNext
Wend
Set ListRS = Nothing
ListRS.Open "select * from JC_LXXZ", MainDB, adOpenStatic, adLockOptimistic
While Not ListRS.EOF
Lxxz.AddItem ListRS!联系性质
ListRS.MoveNext
Wend
If OperateState = "modify" Then
Call Read_Data
End If
End Sub
'读取修改数据
Private Sub Read_Data()
Dim I As Integer
Lxrq.Text = MainRS!联系日期
If MainRS!联系方式 <> "" Then
For I = 0 To Lxfs.ListCount
Lxfs.ListIndex = I
If MainRS!联系方式 = Lxfs.Text Then
Exit For
End If
Next I
End If
If MainRS!联系性质 <> "" Then
For I = 0 To Lxxz.ListCount
Lxxz.ListIndex = I
If MainRS!联系性质 = Lxxz.Text Then
Exit For
End If
Next I
End If
Lxnr.Text = MainRS!联系内容
Fkxx.Text = MainRS!反馈信息
Xclxsj.Text = MainRS!下次联系时间
End Sub
Private Sub Form_Unload(Cancel As Integer)
MDIForm1.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -