查询代码
Dim Value As String =e.Sender.SelectedValue
e.Form.Controls("Table1").Visible = True
Select Case Value
Case "全部"
Dim g As New CrossTableBuilder("统计表1", DataTables("其它采购总表"))
Dim cg As fxDataSource
g.HGroups.AddDef("供应商")
g.VGroups.AddDef("日期",DateGroupEnum.Year, "{0}年")
g.VGroups.AddDef("日期", "{0}月")
g.Totals.AddDef("总金额","金额")
g.Totals.AddDef("日期",AggregateEnum.Count,"采购单数")
g.HorizontalTotal = True
g.VerticalTotal = True
g.Build()
cg=g.BuildDataSource
'Tables("供应商订货月报表_Table1").Visible = True
Tables("其它采购月汇总_Table1").DataSource = cg
Tables("其它采购月汇总_Table1").Cols("供应商").Width = 145
Case "按条件查询"
Dim Filter As String
Dim g As New CrossTableBuilder("统计表1",DataTables("其它采购总表"))
With e.Form.Controls("供应商")
If .Value IsNot Nothing Then
Filter = "供应商 = '" & .Value & "'"
End If
End With
With e.Form.Controls("StartDate")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("EndDate")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 <= #" & .Value & "#"
End If
End With
g.Filter = Filter
Dim cg As fxDataSource
g.HGroups.AddDef("供应商")
g.VGroups.AddDef("日期",DateGroupEnum.Year, "{0}年")
g.VGroups.AddDef("日期", "{0}月")
g.Totals.AddDef("总金额","金额")
g.Totals.AddDef("日期",AggregateEnum.Count,"采购单数")
g.HorizontalTotal = True
g.VerticalTotal = True
g.Build()
cg=g.BuildDataSource
Tables("其它采购月汇总_Table1").DataSource = cg
Tables("其它采购月汇总_Table1").Cols("供应商").Width = 145
End Select
现在的的明细记录代码
If Forms("其它采购月汇总").opened
Tables("其它采购记录_Table1").Filter = "供应商 = '" & Tables("其它采购月汇总_Table1").Current("供应商")&"' "
End if
我现在就是想在查询指定月份的记录