Foxtable(狐表)用户栏目专家坐堂 → 查询


  共有2416人关注过本帖平板打印复制链接

主题:查询

帅哥哟,离线,有人找我吗?
gcc123
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:407 积分:3087 威望:0 精华:0 注册:2014/6/10 11:31:00
查询  发帖心情 Post By:2014/7/11 20:49:00 [只看该作者]

Dim Filter As String
With e.Form.Controls("起始时间")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("结束时间")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 <= #" & .Value & "#"
    End If
End With
Dim ch As WinForm.ComboBox = e.Form.Controls("车号")
Dim cy As WinForm.ComboBox = e.Form.Controls("承运")
Dim ty As WinForm.ComboBox = e.Form.Controls("托运")
Dim sh As WinForm.ComboBox = e.Form.Controls("审核开piao")
Dim hwmc As WinForm.ComboBox = e.Form.Controls("货物名称")
Dim hd As WinForm.ComboBox = e.Form.Controls("回单")
Dim xj As WinForm.ComboBox = e.Form.Controls("现金")
Dim qd As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim zd As WinForm.ComboBox = e.Form.Controls("ComboBox2")
Tables("应付应收录入").Filter = "托运单位 = '" & ty.Text & "' And 车号 = '" & ch.Text & "' And 承运单位 = '" & cy.Text & "'"

按照一个条件或同时几个条件都能查询,最后一句过滤条件的代码应该怎么写?


 回到顶部