Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim f As frmReportBorrowTotal
Dim r As New frmReportBorrowTotal
Dim s, d1, d2 As String
d1 = Format(DateTimePicker1.Value, "MM/dd/") + (DateTimePicker2.Value.Year).ToString + " 00:00:00"
d2 = Format(DateTimePicker2.Value, "MM/dd/") + (DateTimePicker2.Value.Year).ToString + " 23:59:59"
f = New frmReportBorrowTotal
s = "{Borrow.borrow_date}>=#" + d1 + "# and {Borrow.borrow_date}<=#" + d2 + "#"
f.DataDefinition.FormulaFields("Total").Text = "'รายงานวันที่ " + Format(DateTimePicker1.Value, "dd/MM/yyyy") + " - " + Format(DateTimePicker1.Value, "dd/MM/yyyy") + "'"
f.CrystalReportViewer1.ReportSource = r
f.CrystalReportViewer1.SelectionFormula = s
f.CrystalReportViewer1.RefreshReport()
f.Visible = True
End Sub
End Class