Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

<b>Date from and through and QuickReports</b>

Status
Not open for further replies.

heydyrtt

Programmer
Dec 12, 2001
63
US
I'm using two datepickers components, one is a from date and the other the through date. I need the dates that were selected to show on the report that will be printed from the user selecting the dates. example: Sales from 12/01/2002 thru 12/30/2002. I'm using quickreports.


Any help

Thanks

heydyrtt
 
Hi there

One way is to filter the dataset the QuickReport is connected to. For example, if you use a TTable you can use the Filter property or OnFilterRecord event or if you use a TQuery you can use SQL.

Then after the print or preview has finished clear the filter. If I remember correctly you can do that on the AfterPrint/AfterPreview event of TQuickRep

Fore more info please checkout C++Builder help and these links below:




QuickReport tutorial and faq
 
Gday there,

In my report classes, I generally create a "SetParams" method. In your case, I would create one as:

void __fastcall TMyReport::SetParams(TDateTime fromdate, TDateTime todate)
{
// do something with dates
DateLabel->Caption =
fromdate.FormatString("dd-mmm-yyyy") +
" to " +
todate.FormatString("dd-mmm-yyyy");
}

Then call the method with the selected dates prior to calling the report. E.g:

MyReport->SetParams(fromdate->Date, todate->Date);
MyReport->Preview();

Hope this helps...

Regards,
Pat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top