p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

crystal_reports thread: Re: Passing a parameter "date" from VB to Crystal Reports


Message #1 by "Rajnikant" <rajnikantshukla@h...> on Fri, 2 May 2003 11:48:14 +0530
Hi Maria

Try the following code :

 Private Sub Command1_Click()
     CrystalReport1.ParameterFields(0) = "begin_date;Date(" &
Format$(Text1.text,"YYYY,MM,DD")  & ");true;"
     CrystalReport1.ParameterFields(1) = "end_date;Date(" &
Format$(Text2.text,"YYYY,MM,DD") & ");true;"
     CrystalReport1.WindowState = crptMaximized
     CrystalReport1.PrintReport
 End Sub



----- Original Message -----
From: "Maria Georgieva" <mgeorgieva@t...>
To: "crystal_reports" <crystal_reports@p...>
Sent: Friday, January 31, 2003 4:21 PM
Subject: [crystal_reports] Passing a parameter "date" from VB to Crystal
Reports


> Hi
>
> I have a problem with passing "date" parameters from VB to CReports.
> I designed a report in Crystal reports v8.0 and I want to call it from VB
> 6.
> I have 2 parameters which determined what info is displayed on the report
> and I want to get these parameters from VB and pass them to CReports.
> I use informix db via ODBC.
> I made an attempt and understood that
> the code bellow is working if the parameter type is number or string.
> But if it's a "date" - it doesn't work.
>
> My parameters in CReports are :
>     begin_date, date
>     end_date, date
>
> My code in VB is:
>
> Private Sub Command1_Click()
>     CrystalReport1.ParameterFields(0) = "begin_date;" & Text1.text
> & ";true;"
>     CrystalReport1.ParameterFields(1) = "end_date;" & Text2.text &
";true;"
>     CrystalReport1.WindowState = crptMaximized
>     CrystalReport1.PrintReport
> End Sub
>
> In CReports everything is ok when I put the parameters values.
> What to do ?
>
> I hope you help me.
> Thanks, Maria
>

  Return to Index