| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 397 人关注过本帖
标题:问题:“对象变量或with块变量未设置”
只看楼主 加入收藏
jackczw
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2007-6-13
收藏
 问题点数:0 回复次数:0 
问题:“对象变量或with块变量未设置”
问题:“对象变量或with块变量未设置”
Private Sub Command2_Click()
Dim j As Integer
Dim txtSQL As String
If Text1(5) <> Label2(5).Caption Then
If IsDate(Text1(5)) = False Then
MsgBox "起始日期应为日期格式(yyyy-mm-dd)!", vbOKOnly, "警告"
Text1(5).SetFocus
Exit Sub
Else
Text1(5) = Format(Text1(5), "yyyy-mm-dd")
End If
End If
If Text1(6) <> Label2(6).Caption Then
If IsDate(Text1(6)) = False Then
MsgBox "起始日期应为日期格式(yyyy-mm-dd)!", vbOKOnly, "警告"
Text1(6).SetFocus
Exit Sub
Else
Text1(6) = Format(Text1(6), "yyyy-mm-dd")
End If
End If
txtSQL = "select * from student_Form"
If Text1(0) <> Label2(0).Caption Then
txtSQL = txtSQL & " where student_NO='" & Trim(Text1(0)) & "'"
End If
If Text1(1) <> Label2(1).Caption Then
If txtSQL = "select * from student_Form" Then
txtSQL = txtSQL & " where student_Name='" & Trim(Text1(1)) & "'"
Else
txtSQL = txtSQL & " and student_Name='" & Trim(Text1(1)) & "'"
End If
End If
If Text1(4) <> Label2(4).Caption Then
If txtSQL = "select * from student_Form" Then
txtSQL = txtSQL & " where student_Cla='" & Trim(Text1(4)) & "'"
Else
txtSQL = txtSQL & " and student_Cla='" & Trim(Text1(4)) & "'"
End If
End If
If Text1(5) <> Label2(5).Caption And Text1(6) <> Label2(6).Caption Then
If txtSQL = "select * from student_Form" Then
txtSQL = txtSQL & " where Format(student_Esd,'yyyy-mm-dd') >='" & Trim(Text1(5)) & "'and Format(student_Esd,'yyyy-mm-dd') <='" & Trim(Text1(6)) & "'"
Else
txtSQL = txtSQL & " and Format(student_Esd,'yyyy-mm-dd') >='" & Trim(Text1(5)) & "'and Format(student_Esd,'yyyy-mm-dd') <='" & Trim(Text1(6)) & "'"
End If
End If
Set mrc = ExecuteSQL(txtSQL, MsgText)
j = 1
Do While Not mrc.EOF
j = j + 1
mrc.MoveNext
Loop
ProgressBar1.Visible = True
ProgressBar1.Min = CInt(0)
ProgressBar1.Max = CInt(j)
Set mrc = ExecuteSQL(txtSQL, MsgText)
Frame1.Visible = True
With MSFlexGrid1
.Visible = False
.Rows = 1
ProgressBar1.Value = .Rows
Do While Not mrc.EOF
.Rows = .Rows + 1
For i = 0 To mrc.Fields.Count - 1
Select Case mrc.Fields(i).Type
Case adDBDate
.TextMatrix(.Rows - 1, i) = Format(mrc.Fields(i) & "", "yyyy-mm-dd")
Case Else
.TextMatrix(.Rows - 1, i) = mrc.Fields(i) & ""
End Select
Next i
mrc.MoveNext
Loop
.Visible = True
End With
Frame1.Visible = False
mrc.Close
TextDcolor
Text1(4).Visible = True
Combo1.Visible = False
Text1(2).Enabled = False
Text1(3).Enabled = False
Text1(7).Enabled = False
Text1(8).Enabled = False
End Sub
搜索更多相关主题的帖子: 变量 对象 
2007-06-13 19:47
快速回复:问题:“对象变量或with块变量未设置”
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021555 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved