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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I pass datetime parameter value from VB

Status
Not open for further replies.

anshul1966

Programmer
May 25, 2001
5
US
Hello
I have a input parameter of datetime type in my report called "FromDate" and I am trying to pass the value through my ocx control in Visual Basic. I have tried all the followin ways of sending but it is always givng me error "invalid parameter value". The formats I have tried are:
CrystalReport1.ParameterFields(0) = "FromDate;datetime(" & Format(l_s_Time, "YYYY;MM;DD;HH;MM;SS") & ");true")

CrystalReport1.ParameterFields(0) = "FromDate;datetime(" & Format(l_s_Time, "YYYY,MM,DD,HH,MM,SS") & ");true")

CrystalReport1.ParameterFields(0) = "FromDate;datetime('" & Format(l_s_Time, "YYYY/MM/DD HH:MM:SS AMPM") & "');true")

I hope somebody can help me with this.

Thanks
 
I've faught with this myself,

I copied a bit of code from one of my apps for you to try.

START1 = DTPicker1
START2 = Format(START1, "yyyy/MM/dd")
START3 = Format(START1, "dd/MM/yy")
End1 = DTPicker2
End2 = Format(End1, "yyyy/MM/dd")
END3 = Format(End1, "dd/MM/yy")

ABOVE... DATE PICKER TO GET DATE, AND THEN FORMATTING IT TO MATCH WHAT THE REPORT CALLS FOR.

If OptDailyF.Value = True Then

CrystalReport1.ReportFileName = "G:\CITECT\Reports\Oracle\d-01_FEV_Daily_Flow"
CrystalReport1.ParameterFields(0) = "START;" & START2 & ";True"
CrystalReport1.ParameterFields(1) = "END;" & End2 & ";True"
CrystalReport1.Connect = "PWD = REPORTS"
CrystalReport1.PrintReport
End If
ABOVE IN THE THIRD LINE "START" IS NAME OF PARAMETER."&START2" IS THE PARAMETER VALUE BEING PASSED TO CRYSTAL. "TRUE" WILL NOT SHOW PARAMETER THAT IS PASSED. HOWEVER BY SETTING THIS TO FALSE YOU CAN SEE WHAT VALUE IS BEING PASSED TO CRYSTAL FROM VB.
HOPE THIS HELPS
CURT
 
Hi CurtR

Actually I am trying to pass DateTime parameter not only Date. I am able to pass the Date type parameter but not the DateTime type.

Actually I read on Seagate site that it is not possible to pass time or datetime type values from VB till version 7.0 and they say that it is corrected for version 8.0 which is the one I am using but still unable to pass the values.
 
Hi ansul1966
I suggest you to try
1. open your crystal report file
2. click menu File and select Report Options
3. don't check Convert Date-Time to Date
 
Shura I am not doing "convert date-time to date" but still no success.
For this application we have droped the idea of using datetime type parameter and are now using only the date type.
The error might be due the fact that I am using Professional edition and not developers edition of CR version 8.0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top