读书人

小弟我的代码错哪了

发布时间: 2011-12-31 23:50:30 作者: rapoo

我的代码哪里错了?
If Check1.Value = 1 And Check2.Value = 0 And Check3.Value = 0 And Check4.Value = 0 Then
Adodc1.RecordSource = "select * from 项目信息 where 申报日期 between '" + Chr(35) + Str(DTPicker1.Value) + Chr(35) + "' and '" + Chr(35) + Str(DTPicker2.Value) + Chr(35) + "'"
Adodc1.Refresh
End If

这个代码老是出现说对象refresh方法的IACODC失败

[解决办法]
between Chr(35) + " + str(DTPicker1.Value) + "+ Chr(35) and Chr(35) +" + Str(DTPicker2.Value) + "+ Chr(35)"


where 申报日期>= # " & DTPicker1.Value & " # and 申报日期<= #" & DTPicker2.Value &"# "
&之间de 空格少了没有
[解决办法]
If Check1.Value = 1 And Check2.Value = 0 And Check3.Value = 0 And Check4.Value = 0 Then
Adodc1.RecordSource = "select * from 项目信息 where 申报日期>= # " & DTPicker1.Value & " # and 申报日期<= #" & DTPicker2.Value & "# "

读书人网 >VB

热点推荐