📄 客户投诉.frm
字号:
Left = 120
TabIndex = 27
Top = 960
Width = 855
End
Begin VB.Label Label13
BackColor = &H00FFC0C0&
Caption = "接待员:"
Height = 255
Left = 4800
TabIndex = 16
Top = 3120
Width = 735
End
Begin VB.Label Label12
BackColor = &H00FFC0C0&
Caption = "录入员:"
Height = 255
Left = 120
TabIndex = 15
Top = 3120
Width = 735
End
Begin VB.Label Label11
BackColor = &H00FFC0C0&
Caption = "处理结果:"
Height = 255
Left = 120
TabIndex = 14
Top = 2520
Width = 855
End
Begin VB.Label Label9
BackColor = &H00FFC0C0&
Caption = "投诉内容:"
Height = 255
Left = 120
TabIndex = 13
Top = 1920
Width = 855
End
Begin VB.Label Label2
BackColor = &H00FFC0C0&
Caption = "序 号:"
Height = 255
Left = 120
TabIndex = 12
Top = 480
Width = 855
End
Begin VB.Label Label8
BackColor = &H00FFC0C0&
Caption = "投诉人联系方式:"
Height = 255
Left = 5400
TabIndex = 10
Top = 1440
Width = 1455
End
Begin VB.Label Label7
BackColor = &H00FFC0C0&
Caption = "投 诉 人:"
Height = 255
Left = 5400
TabIndex = 8
Top = 960
Width = 1455
End
Begin VB.Label Label6
BackColor = &H00FFC0C0&
Caption = "投诉类别:"
Height = 255
Left = 120
TabIndex = 7
Top = 1440
Width = 855
End
Begin VB.Label Label5
BackColor = &H00FFC0C0&
Caption = "投诉时间:"
Height = 255
Left = 2760
TabIndex = 6
Top = 1440
Width = 855
End
Begin VB.Label Label4
BackColor = &H00FFC0C0&
Caption = "房 号:"
Height = 255
Left = 2760
TabIndex = 5
Top = 960
Width = 855
End
Begin VB.Label Label3
BackColor = &H00FFC0C0&
Caption = "标 题:"
Height = 255
Left = 2760
TabIndex = 3
Top = 480
Width = 855
End
End
Begin MSAdodcLib.Adodc Adodc2
Height = 375
Left = 3120
Top = 1560
Visible = 0 'False
Width = 1815
_ExtentX = 3201
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=物业管理系统;Data Source=(local)"
OLEDBString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=物业管理系统;Data Source=(local)"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from 客户投诉信息"
Caption = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 5040
Top = 1560
Visible = 0 'False
Width = 1815
_ExtentX = 3201
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=物业管理系统;Data Source=(local)"
OLEDBString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=物业管理系统;Data Source=(local)"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "客户投诉信息"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
End
Attribute VB_Name = "客户投诉"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim isadding As Boolean
Dim objcn As Connection
Dim objflor As Recordset
Dim objcall As Recordset
Dim objhome As Recordset
'选择住户名称
Private Sub Cmbroom_Click()
Dim objlog As New Recordset
Set objlog = objhome.Clone '克隆数据源
With objlog
If .RecordCount > 0 Then
.Find "房号='" & Trim(Cmbroom.Text) & "'"
If .EOF Then
MsgBox "没有此人"
Else
Text3.Text = objlog.Fields("住户名称")
End If
End If
End With
End Sub
Private Sub Cmbtype_Click()
'获取楼房区信息
Set objhome = New Recordset
With objhome
Set .ActiveConnection = objcn
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Open "select * from " & Trim(Cmbtype.Text)
Set .ActiveConnection = Nothing '断开数据库联接
End With
With objhome
If .RecordCount > 0 Then
.MoveFirst
While Not .EOF
Cmbroom.AddItem .Fields("房号")
.MoveNext
Wend
End If
End With
End Sub
'添加记录
Private Sub Cmdadd_Click()
If isadding = False Then
Adodc2.Recordset.AddNew
Text1.Text = "自动编号"
Text2.Text = ""
Cmbtype.Text = ""
Cmbroom.Text = ""
Text3.Text = ""
Cmbclass.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
'可写状态
Text2.Enabled = True
Cmbtype.Enabled = True
Cmbroom.Enabled = True
Text3.Enabled = True
Cmbclass.Enabled = True
DTP1.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
Text7.Enabled = True
Text8.Enabled = True
Text9.Enabled = True
isadding = True
Else
MsgBox "已是添加记录状态!", vbCritical, "温馨提示"
End If
End Sub
'退出添加状态
Private Sub Cmdback_Click()
If isadding Then
isadding = False
End If
End Sub
'删除记录
Private Sub Cmddelete_Click()
If isadding = True Then
MsgBox "当前为状态为添加记录状态,不能删除记录"
Adodc2.Recordset.CancelBatch '显示当前记录
Else
If MsgBox("是否要删除当前记录?", vbYesNo + vbQuestion, "温馨提示") = vbYes Then
Adodc2.Recordset.Delete
Adodc2.Recordset.Requery
End If
End If
Adodc2.Refresh
End Sub
Private Sub Cmdexit_Click()
物业管理系统.Show
Unload Me
End Sub
Private Sub Cmdsave_Click()
If isadding = False Then
MsgBox "此状态不允许保存" & vbCrLf & "请添加记录!", vbCritical, "温馨提示"
Exit Sub
End If
With objcall
If Text2.Text = "" Then
MsgBox "请输入投诉标题!", vbInformation, "温馨提示"
Text2.SetFocus
Text2.Text = ""
Exit Sub
End If
If Cmbtype.Text = "" Then
MsgBox "请选择所属大楼!", vbInformation, "温馨提示"
Cmbtype.SetFocus
Exit Sub
End If
If Trim(Cmbroom.Text) = "" Then
MsgBox "请选择设诉人房间", vbInformation, "温馨提示"
Cmbroom.SetFocus
Exit Sub
End If
If Trim(Cmbclass.Text) = "" Then
MsgBox "请选择投诉类别", vbInformation, "温馨提示"
Cmbclass.SetFocus
Exit Sub
End If
If Trim(Text6.Text) = "" Then
MsgBox "请输入投诉内容!", vbInformation, "温馨提示"
Text6.SetFocus
Exit Sub
End If
If Trim(Text7.Text) = "" Then
MsgBox "请输入处理结果!", vbInformation, "温馨提示"
Text7.SetFocus
Exit Sub
End If
'保存信息
If isadding Then objcall.AddNew
.Fields("标题") = Trim(Text2.Text)
.Fields("房号") = Trim(Cmbroom.Text)
.Fields("大楼名称") = Trim(Cmbtype.Text)
.Fields("投诉人") = Trim(Text3.Text)
.Fields("投诉类别") = Trim(Cmbclass.Text)
.Fields("投诉时间") = Trim(DTP1.Value)
.Fields("投诉人联系方式") = Trim(Text5.Text)
.Fields("投诉内容") = Trim(Text6.Text)
.Fields("处理结果") = Trim(Text7.Text)
.Fields("录入员") = Trim(Text8.Text)
.Fields("接待员") = Trim(Text9.Text)
objcall.Update
MsgBox "数据保存成功!", vbInformation, "温馨提示"
isadding = False
End With
Adodc2.Refresh '刷新记录
End Sub
'取消增加记录
Private Sub Command1_Click()
If isadding = True Then
MsgBox "是否放弃添加记录?", vbQuestion, "温馨提示"
Adodc2.Recordset.CancelBatch
Adodc2.Recordset.Requery
isadding = False
End If
End Sub
'按类别查找记录
Private Sub DataCombo1_Click(Area As Integer)
If DataCombo1.BoundText = "" Then
MsgBox "请选择投诉类别", vbExclamation, "温馨提示"
DataCombo1.SetFocus
Exit Sub
End If
a = DataCombo1.BoundText
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find ("投诉类别='" & a & "'")
'If Adodc1.Recordset.EOF Then
'MsgBox "未找到记录", vbCritical, "温馨提示"
'DataCombo1.SetFocus
'Exit Sub
'End If
b = "select * from 客户投诉信息 where 投诉类别='" & Adodc1.Recordset("投诉类别") & "'"
Adodc2.RecordSource = b
Adodc2.Refresh
End Sub
Private Sub Form_Load()
'Cmdsave.Enabled = False
'Cmdback.Enabled = False
'Command1.Enabled = False
Label1.Visible = False
DataCombo1.Visible = False
'建立数据库联接
Set objcn = New Connection '实例化联接对象
With objcn '建立数据库联接
.Provider = "SQLOLEDB"
.ConnectionString = "User ID=sa;PWD=sa;Data Source=(local);" & _
"Initial Catalog=物业管理系统"
.Open
End With
'获取客户投诉信息数据
Set objcall = New Recordset
With objcall
Set .ActiveConnection = objcn
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Open "select * from 客户投诉信息"
End With
'获取大楼信息数据
Set objflor = New Recordset
With objflor
Set .ActiveConnection = objcn
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Open "select * from 大楼信息"
End With
With objflor
If .RecordCount > 0 Then
.MoveFirst
While Not .EOF
Cmbtype.AddItem .Fields("大楼名称")
.MoveNext
Wend
End If
End With
End Sub
'选择查找按钮
Private Sub Option2_Click()
Label1.Visible = True
DataCombo1.Visible = True
End Sub
Private Sub CataCombo1_Click()
a = DataCombo1.BoundText
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find ("投诉类别='" & a & "'")
b = "select * from 客户投诉信息 where 投诉类别='" & Adodc1.Recordset("投诉类别") & "'"
Adodc2.RecordSource = b
Adodc2.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -