老师:你好!
我想单表查询订单明细中所有客户截至今天的最后一条订单,现在的代码没能找出截至今天的最后一条合同记录。
请帮助修改。
Dim Filter1 As String
With e.Form.Controls("日期")
If .Value IsNot Nothing Then
If Filter1 >"" Then
Filter1 = Filter1 & " And "
End If
Filter1 = Filter1 & "{合同记录}.日期 < '" & .Value & "'"
End If
End With
Dim jb As New SQLJoinTableBuilder("查询表1","合同记录")
jb.C
Dim dt As fxDataSource
jb.AddTable("合同记录","合同编号")
jb.AddCols("{合同记录}.省市","{合同记录}.县市", "{合同记录}.客户名称","{合同记录}.合同编号","{合同记录}.合同金额")
jb.AddExp("{合同记录}.日期","max[日期]")
jb.Filter = Filter1
dt = jb.BuildDataSource()
Tables("查询_Table1").DataSource = dt '将统计结果绑定到Table