以前打开项目都是加载表全部数据 直接用内部方式进行查询数据 ,现在打开项目不加载任何数据要使用sql语句进行查询 要怎么改代码啊
Dim Filter As String
With e.Form.Controls("付款科目")
If .Value IsNot Nothing Then
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
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 "
Filter = Filter & "日期 <= #" & .Value & "#"
End If
End If
End With
With e.Form.Controls("付款账号")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "付款账号 like'*" & .text & "*'"
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
If Filter > "" Then
Tables("付款明细").Filter = Filter
End If