求解决“未找到方法或数据成员”
一运行就出现“未找到方法或数据成员” Comdepart.Clear
Comdepart.AddItem ("工商")
Comdepart.AddItem ("教务")
Comdepart.AddItem ("总务")
Comdepart.AddItem ("信息系")
Comdepart.AddItem ("生物系")
窗体代码:Private Sub Check0_Click(Index As Integer)
txtjsbh.Enabled = Not txtjsbh.Enabled
End Sub
Private Sub Check1_Click(Index As Integer)
Comdepart.Enabled = Not Comdepart.Enabled
End Sub
Private Sub Check2_Click(Index As Integer)
txtxm.Enabled = Not txtxm.Enabled
End Sub
Private Sub Check3_Click(Index As Integer)
Comsex.Enabled = Not Comsex.Enabled
End Sub
Private Sub Check4_Click(Index As Integer)
Txtzwzc.Enabled = Not Txtzwzc.Enabled
End Sub
Private Sub Check5_Click(Index As Integer)
Combzz.Enabled = Not Combzz.Enabled
End Sub
Private Sub Check6_Click(Index As Integer)
txtfpsj.Enabled = Not txtfpsj.Enabled
End Sub
Private Sub Check7_Click(Index As Integer)
Comdb.Enabled = Not Comdb.Enabled
End Sub
Private Sub Check8_Click(Index As Integer)
txtbcms.Enabled = Not txtbcms.Enabled
End Sub
Private Sub Check9_Click(Index As String)
txtzfmj.Enabled = Not txtzfmj.Enabled
End Sub
Private Sub Check10_Click(Index As Integer)
Txtgzsj.Enabled = Not Txtgzsj.Enabled
End Sub
Private Sub Command1_Click()
myflexgrid.Clear
Call sx
Dim txtSQL As String
Dim mrc As ADODB.Recordset
Dim n As Integer
txtSQL = "select information.教师编号,information.部门,姓名,性别,职务职称,在职情况,分配时间,是否达标,达标面积差额,现有住房面积,参加工作时间 "
If Check1.Value Then
If Trim(txtjsbh.Text) = "" Then
MsgBox "教师编号不能为空", vbOKOnly + vbExclamation, "警告"
txtjsbh.SetFocus
Exit Sub
Else
txtSQL = txtSQL & " and information.教师编号= '" & txtjsbh & "'"
End If
End If
If Check2.Value Then
If Trim(Comdepart.Text) = "" Then
MsgBox "部门不能为空", vbOKOnly + vbExclamation, "警告"
txtdepart.SetFocus
Exit Sub
Else
txtSQL = txtSQL & " and 部门= '" & txtdepart & "'"
End If
End If
If Check3.Value Then
If Trim(txtxm.Text) = "" Then
MsgBox "姓名不能为空", vbOKOnly + vbExclamation, "警告"
txtxm.SetFocus
Exit Sub
Else
txtSQL = txtSQL & " and 姓名= '" & txtxm & "'"
End If
End If
If Check4.Value Then
If Trim(Comsex.Text) = "" Then
MsgBox "性别不能为空", vbOKOnly + vbExclamation, "警告"
Comsex.SetFocus
Exit Sub
Else
txtSQL = txtSQL & " and 性别= '" & Comsex & "'"
End If
End If
If Check5.Value Then
If Trim(Txtzwzc.Text) = "" Then
MsgBox "职务职称不能为空", vbOKOnly + vbExclamation, "警告"
Txtzwzc.SetFocus
Exit Sub
Else
txtSQL = txtSQL & " and 职务职称= '" & Txtzwzc & "'"
End If
End If
If Check6.Value Then
If Trim(Combzz.Text) = "" Then
MsgBox "在职情况不能为空", vbOKOnly + vbExclamation, "警告"
Combzz.SetFocus
Exit Sub
Else
txtSQL = txtSQL & " and 在职情况= '" & Combzz & "'"
End If
End If
If Check7.Value Then
If Trim(txtfpsj.Text) = "" Then
MsgBox "分配时间不能为空", vbOKOnly + vbExclamation, "警告"
txtfpsj.SetFocus
Exit Sub
Else
txtSQL = txtSQL & " and 分配时间= '" & txtfpsj & "'"
End If
End If
If Check8.Value Then
If Trim(Comdb.Text) = "" Then
MsgBox "是否达标", vbOKOnly + vbExclamation, "警告"
Comdb.SetFocus
Exit Sub
Else
txtSQL = txtSQL & " and 是否达标='" & Comdb & "'"
End If
End If
If Check9.Value Then
If Trim(txtbcms.Text) = "" Then
MsgBox "达标面积差额", vbOKOnly + vbExclamation, "警告"
txtbcms.SetFocus
Exit Sub
Else
txtSQL = txtSQL & " and 达标面积差额= '" & txtbcms & "'"
End If
End If
If Check10.Value Then
If Trim(txtzfmj.Text) = "" Then
MsgBox "现有住房面积", vbOKOnly + vbExclamation, "警告"
txtzfmj.SetFocus
Exit Sub
Else
txtSQL = txtSQL & " and 现有住房面积='" & txtzfmj & "'"
End If
End If
If Check11.Value Then
If Trim(Txtgzsj.Text) = "" Then
MsgBox "参加工作时间", vbOKOnly + vbExclamation, "警告"
Txtgzsj.SetFocus
Exit Sub
Else
txtSQL = txtSQL & " and 参加工作时间='" & Txtgzsj & "'"
End If
End If
If (Check0.Value Or Check1.Value Or Check2.Value Or Check3.Value Or Check4.Value Or Check5.Value Or Check6.Value Or Check7.Value Or Check8.Value Or Check9.Value Or Check10.Value) = False Then
MsgBox "请设置查询方式!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
txtSQL = txtSQL & " order by information.教师编号"
Set mrc = executeSQL(txtSQL)
If mrc.EOF = False Then
mrc.MoveFirst
With myflexgrid
.Rows = 1500
.Row = 1
Do While Not mrc.EOF
n = n + 1
For i = 1 To mrc.Fields.Count
.TextMatrix(.Row, i) = mrc.Fields(i - 1)
Next i
.Row = .Row + 1
mrc.MoveNext
Loop
End With
Else
MsgBox "对不起,没有此老师的档案记录!", vbOKOnly, "查询"
End If
mrc.Close
Text1 = n
End Sub
Private Sub Command2_Click()
myflexgrid.Clear
Call sx
txtjsbh = ""
Comdepart = ""
txtxm = ""
Comsex = ""
Txtzwzc = ""
Combzz = ""
txtfpsj = ""
Comdb = ""
txtbcms = ""
txtzfmj = ""
Txtgzsj = ""
Text1 = ""
Check0.Value = False
Check1.Value = False
Check2.Value = False
Check3.Value = False
Check4.Value = False
Check5.Value = False
Check6.Value = False
Check7.Value = False
Check8.Value = False
Check9.Value = False
Check10.Value = False
txtjsbh.Enabled = False
Comdepart.Enabled = False
txtxm.Enabled = False
Comsex.Enabled = False
Txtzwzc.Enabled = False
Combzz.Enabled = False
txtfpsj.Enabled = False
Comdb.Enabled = False
txtbcms.Enabled = False
txtzfmj.Enabled = False
Txtgzsj.Enabled = False
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Command4_Click()
Dim i As Integer
Dim j As Integer
Dim xlApp As New Excel.Application
Dim xlBook As New Excel.Workbook
Dim xlSheet As New Excel.Worksheet
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
'Set xlBook = xlApp.Workbooks.Add
On Error Resume Next
Set xlBook = xlApp.Workbooks.Open(App.Path & "\vvv.xls")
'Set xlSheet = xlBook.Worksheets(1)
For i = 0 To myflexgrid.Rows - 1
For j = 1 To myflexgrid.Cols - 1
xlSheet.Cells(i + 1, j) = myflexgrid.TextMatrix(i, j)
Next j
Next i
If IsNull(myflexgrid.Text) = False Then
xlSheet.Cells(i + 2, j + 1) = myflexgrid.Text
End If
End Sub
Private Sub Form_Load()
Dim aa As String
Dim rst As ADODB.Recordset
aa = "select distinct 教师编号 from information order by 教师编号"
Set rst = executeSQL(aa)
Do While Not rst.EOF
Txtgzsj.AddItem rst.Fields(0)
rst.MoveNext
Loop
Comdepart.Clear
Comdepart.AddItem ("工商")
Comdepart.AddItem ("教务")
Comdepart.AddItem ("总务")
Comdepart.AddItem ("信息系")
Comdepart.AddItem ("生物系")
Comdepart.AddItem ("财务")
Comdepart.AddItem ("视觉")
Comdepart.AddItem ("招就办")
Comdepart.AddItem ("环艺")
Comdepart.AddItem ("继教院")
Comdepart.AddItem ("商流系")
Comdepart.AddItem ("离退处")
Comdepart.AddItem ("美院")
Comdepart.AddItem ("办公室")
Comdepart.AddItem ("财税系")
Comdepart.AddItem ("思政部")
Comdepart.AddItem ("公共")
Comdepart.AddItem ("体育部")
Comdepart.AddItem ("保卫处")
Comsex.Clear
Comsex.AddItem ("男")
Comsex.AddItem ("女")
Combzz.Clear
Combzz.AddItem ("退休")
Combzz.AddItem ("在职")
Combzz.AddItem ("死亡")
Combzz.AddItem ("特殊")
Comdepart.AddItem ("宣传部")
Comdb.Clear
Comdb.AddItem ("是")
Comdb.AddItem ("否")
Call sx
If usertype = "1" Then
Dim qq As String
qq = "select * from tc information where 教师编号='" & txtjsbh & "'"
Set rst = executeSQL(qq)
With myflexgrid
.Rows = 50
.Rows = 1
Do While Not rst.EOF
For i = 1 To rst.Fields.Count
If i = 7 Then
Dim qq1 As String
Dim rst1 As ADODB.Recordset
qq1 = "select * from information where 教师编号='" & rst.Fields(i - 1) & "'"
Set rst1 = executeSQL(qq1)
.TextMatrix(.Row, i) = rst1.Fields(0)
Else
.TextMatrix(.Row, i) = rst.Fields(i - 1)
End If
Next i
.Row = .Row + 1
rst.MoveNext
Loop
End With
Frame1.Visible = False
Command1.Enabled = False
Command3.Enabled = False
Else
txtjsbh.Enabled = False
Comdepart.Enabled = False
txtxm.Enabled = False
Comsex.Enabled = False
Txtzwzc.Enabled = False
Combzz.Enabled = False
txtfpsj.Enabled = False
Comdb.Enabled = False
txtbcms.Enabled = False
txtzfmj.Enabled = False
Txtgzsj.Enabled = False
Comsex.AddItem "男"
Comsex.AddItem "女"
txtjsbh = ""
Comdepart = ""
txtxm = ""
Comsex = ""
Txtzwzc = ""
Combzz = ""
txtfpsj = ""
Comdb = ""
txtbcms = ""
txtzfmj = ""
Txtgzsj = ""
Check0.Value = False
Check1.Value = False
Check2.Value = False
Check3.Value = False
Check4.Value = False
Check5.Value = False
Check6.Value = False
Check7.Value = False
Check8.Value = False
Check9.Value = False
Check10.Value = False
End If
End Sub
Private Sub sx()
With myflexgrid
.Cols = 10
.CellAlignment = 4
.TextMatrix(0, 1) = "教师编号"
.TextMatrix(0, 2) = "姓名"
.TextMatrix(0, 3) = "在职情况"
.TextMatrix(0, 4) = "性别"
.TextMatrix(0, 5) = "职务职称"
.TextMatrix(0, 6) = "部门"
.TextMatrix(0, 7) = "分配时间"
.TextMatrix(0, 8) = "是否达标"
.TextMatrix(0, 9) = "达标面积差额"
.TextMatrix(0, 10) = "现有住房面积"
.TextMatrix(0, 11) = "参加工作时间"
End With
myflexgrid.ColWidth(1) = 3400
myflexgrid.ColWidth(8) = 2000
End Sub