0
votes

I want to print some data in crystal report from VB6 form using date range filter,

Example in VB6 form there is Date field 1 = date1.value Date field 2 = date2.value

and print in the crystal report form using Group formula with date range filter

Ado.date

Thank you

1

1 Answers

0
votes

use this function ...

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

' and in form call function as follows

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