在查询窗口输入查询条件,在显示窗口MSHFlexGrid(MSF1)中显示出查询出来的数据,但我现在出现了给问题就是,下别的条件都行,但是下时间条见就不行了,我的代码如下:
If Trim(DTPicker1.Value) <> "" And Trim(DTPicker2.Value) <> "" Then
aa = 1
If txtsql = "" Then
txtsql = " (ywxx.初次联系时间>='" & CDate(Trim(DTPicker1.Value)) & "' and ywxx.初次联系时间<='" & CDate(Trim(DTPicker2.Value)) & "')"
Else
txtsql = txtsql & "and( ywxx.初次联系时间>='" & CDate(Trim(DTPicker1.Value)) & "' and ywxx.初次联系时间<='" & CDate(Trim(DTPicker2.Value)) & "')"
End IfElse
If Trim(DTPicker1.Value) <> "" And Trim(DTPicker2.Value) = "" Then
aa = 1
If txtsql = "" Then
txtsql = " ywxx.初次联系时间='" & CDate(Trim(DTPicker1.Value)) & "'"
Else
txtsql = "and ywxx.初次联系时间='" & CDate(Trim(DTPicker1.Value)) & "'"
End If
End If
If aa = 0 Then
ss = MsgBox("你至少要输入一个条件以上才能查询!", , " 警告")
Text1.SetFocus
Exit Sub
End IfDim str As String
str = "select * from ywxx where " & txtsql
Dim mrc As ADODB.Recordset
Set mrc = ExecuteSQL(str)
If mrc.EOF = True Then
zzz = MsgBox("对不起,没有相关记录!", vbOKOnly, "查询")
form3.ZOrder (0)
form3.Text1.SetFocus
Exit Sub
End If
txtsql = "select * from ywxx where " & txtsql & ""
form4.printstr = txtsql
find = True
form4.Show
form4.Caption = "业务信息查询结果"
form4.showtitle
form4.showdata
各位都帮忙看下,问题出在哪
If Trim(DTPicker1.Value) <> "" And Trim(DTPicker2.Value) <> "" Then
aa = 1
If txtsql = "" Then
txtsql = " (ywxx.初次联系时间>='" & CDate(Trim(DTPicker1.Value)) & "' and ywxx.初次联系时间<='" & CDate(Trim(DTPicker2.Value)) & "')"
Else
txtsql = txtsql & "and( ywxx.初次联系时间>='" & CDate(Trim(DTPicker1.Value)) & "' and ywxx.初次联系时间<='" & CDate(Trim(DTPicker2.Value)) & "')"
End IfElse
If Trim(DTPicker1.Value) <> "" And Trim(DTPicker2.Value) = "" Then
aa = 1
If txtsql = "" Then
txtsql = " ywxx.初次联系时间='" & CDate(Trim(DTPicker1.Value)) & "'"
Else
txtsql = "and ywxx.初次联系时间='" & CDate(Trim(DTPicker1.Value)) & "'"
End If
End If
If aa = 0 Then
ss = MsgBox("你至少要输入一个条件以上才能查询!", , " 警告")
Text1.SetFocus
Exit Sub
End IfDim str As String
str = "select * from ywxx where " & txtsql
Dim mrc As ADODB.Recordset
Set mrc = ExecuteSQL(str)
If mrc.EOF = True Then
zzz = MsgBox("对不起,没有相关记录!", vbOKOnly, "查询")
form3.ZOrder (0)
form3.Text1.SetFocus
Exit Sub
End If
txtsql = "select * from ywxx where " & txtsql & ""
form4.printstr = txtsql
find = True
form4.Show
form4.Caption = "业务信息查询结果"
form4.showtitle
form4.showdata
各位都帮忙看下,问题出在哪
txtsql = " ywxx.初次联系时间='" & CDate(Trim(DTPicker1.Value)) & "'" 应该是
txtsql = " ywxx.初次联系时间=#CDate(Trim(DTPicker1.Value))#