窗口中有一个[查询]控件,其代码为:
Dim Filter As String
With e.Form.Controls("TextBox1")
If .Value IsNot Nothing Then
Filter = "clxx_lphm = '" & .Value & "'"
End If
End With
With e.Form.Controls("ComboBox1")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "clxx_cpys = '" & .Value & "'"
End If
End With
With e.Form.Controls("DateTimePicker1")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "jbxx_jcsj >= #" & .Value & "#"
End If
End With
With e.Form.Controls("DateTimePicker2")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "jbxx_jcsj <= #" & .Value & "#"
End If
End With
With e.Form.Controls("ComboBox2")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "ajclqh_tijiaoqh = '" & .Value & "'"
End If
End With
If Filter > "" Then
Tables("ybchengxu").Filter = Filter
End If
要求:按照上面的查询代码查到的结果重新生成一个新表在窗口内显示,显示的列名不跟“ybchengxu”表中的列名一样,列名由代码来指定(窗口的表不绑定任何表)
请问大侠们,这个代码应如何写,请指教,谢谢!