以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]查询窗口问题(代码哪里有问题)?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=80744)

--  作者:yaorxin
--  发布时间:2016/1/30 23:32:00
--  [求助]查询窗口问题(代码哪里有问题)?

代码如下,请问这个有什么问题吗?


图片点击可在新窗口打开查看此主题相关图片如下:11.png
图片点击可在新窗口打开查看


 

Dim zb As WinForm.ComboBox = e.Form.Controls("组别")
Dim cddh As WinForm.TextBox = e.Form.Controls("出单单号")
Dim jddh As WinForm.TextBox = e.Form.Controls("进单单号")
Dim bz As WinForm.TextBox = e.Form.Controls("备注")
Dim StartDate As WinForm.DateTimePicker = e.Form.Controls("开始时间")
Dim Filter   As   String
With e.Form.Controls("出单单号")
    If .Value   IsNot   Nothing  Then
        Filter =   "出单单号 = \'*" & cddh.Value &   "*\'"
    End   If
End   With
With e.Form.Controls("备注")
    If .Value   IsNot   Nothing   Then
        If Filter > ""   Then
            Filter = Filter &   " And "
        End   If
        Filter = Filter &   "备注 = \'*" & bz.Value &   "*\'"
    End   If
End   With
With e.Form.Controls("组别")
    If .Value   IsNot   Nothing   Then
        If Filter > ""   Then
            Filter = Filter &   " And "
        End   If
        Filter = Filter &   "组别 = \'*" & zb.Value &   "*\'"
    End   If
   
End   With
With e.Form.Controls("进单单号")
    If .Value   IsNot   Nothing   Then
        If Filter >""   Then
            Filter = Filter &   " And "
        End   If
        Filter = Filter &   "进单单号 = \'*" & jddh.Value &   "*\'"
    End   If
End   With
 With e.Form.Controls("开时时间")
       If .Value   IsNot   Nothing   Then
           If Filter >""   Then
             Filter = Filter &   " And "
           End   If
         Filter = Filter &   "要求出单时间 = #" & StartDate .Value &   "#"
       End   If
 End   With
If   Filter >   "" Then
    Tables("进出单表").Filter =   Filter
End If


--  作者:大红袍
--  发布时间:2016/1/31 9:41:00
--  
Dim zb As WinForm.ComboBox = e.Form.Controls("组别")
Dim cddh As WinForm.TextBox = e.Form.Controls("出单单号")
Dim jddh As WinForm.TextBox = e.Form.Controls("进单单号")
Dim bz As WinForm.TextBox = e.Form.Controls("备注")
Dim StartDate As WinForm.DateTimePicker = e.Form.Controls("开始时间")
Dim Filter   As   String
With e.Form.Controls("出单单号")
    If .Value   IsNot   Nothing  Then
        Filter =   "出单单号 like \'%" & cddh.Value &   "%\'"
    End   If
End   With
With e.Form.Controls("备注")
    If .Value   IsNot   Nothing   Then
        If Filter > ""   Then
            Filter = Filter &   " And "
        End   If
        Filter = Filter &   "备注 like \'%" & bz.Value &   "%\'"
    End   If
End   With
With e.Form.Controls("组别")
    If .Value   IsNot   Nothing   Then
        If Filter > ""   Then
            Filter = Filter &   " And "
        End   If
        Filter = Filter &   "组别 like \'%" & zb.Value &   "%\'"
    End   If
   
End   With
With e.Form.Controls("进单单号")
    If .Value   IsNot   Nothing   Then
        If Filter >""   Then
            Filter = Filter &   " And "
        End   If
        Filter = Filter &   "进单单号 like \'%" & jddh.Value &   "%\'"
    End   If
End   With
 With e.Form.Controls("开时时间")
       If .Value   IsNot   Nothing   Then
           If Filter >""   Then
             Filter = Filter &   " And "
           End   If
         Filter = Filter &   "要求出单时间 = #" & StartDate .Value &   "#"
       End   If
 End   With
If   Filter >   "" Then
    Tables("进出单表").Filter =   Filter
End If

--  作者:yaorxin
--  发布时间:2016/1/31 10:57:00
--  

谢谢版主,其他事以查找了,就是“要求出单时间“无法查找,是哪里有问题?


--  作者:大红袍
--  发布时间:2016/1/31 10:58:00
--  
Filter = Filter &   "要求出单时间 >= #" & StartDate .Value &   "# And 要求出单时间 < #" & StartDate .Value.AddDays(1) & "#"
--  作者:yaorxin
--  发布时间:2016/1/31 11:27:00
--  
找到问题了,控件改为datetime和表一致就可以了。谢谢