VB6打印水晶报告使用日期范围过滤器

时间:2014-01-27 06:34:07

标签: vb6 crystal-reports

我想使用日期范围过滤器

从VB6表格打印水晶报表中的一些数据

有VB6形式的例子 日期字段1 = date1.value 日期字段2 = date2.value

并使用具有日期范围过滤器的组公式

在水晶报表中打印

Ado.date

谢谢

1 个答案:

答案 0 :(得分:0)

  

使用此功能...

Public Function ReportDateFilter(Date1 As Date, Date2 As Date, DataField As String) As String
Dim A1 As String
Dim b1 As String
Dim c1 As String
Dim d1 As String
Dim E1 As String
Dim f1 As String

A1 = Format(Date1, "yyyy") & ","
b1 = Format(Date1, "mm") & ","
c1 = Format(Date1, "dd")

d1 = Format(Date2, "yyyy") & ","
E1 = Format(Date2, "mm") & ","
f1 = Format(Date2, "dd")

ReportDateFilter2 = "{" & DateField & "} in Date (" & A1 & b1 & c1 & ")" & " " & "to Date (" & d1 & E1 & f1 & ")"
End Function
  

'和表单调用函数如下

cry.SelectionFormula = ReportDateFilter(fromDate.Text, Todate.Text, "tablename.Datefield")