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

Passing Datefield parameter value to Crystal Reports XI

Status
Not open for further replies.

Parkaboy

MIS
Dec 2, 2002
22
0
0
US
Morning All:

I have written an application with VB.Net that successfully prompts and passes STRINGFIELD parameter values through VB to Crystal Reports. Everything is working great, until I try to pass a Datafield value. None of the formats I tried to pass appear to provide the correct format. The date field requires the yyyy-MM-dd format and I am using the following coded to convert:

dX = String.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(dX))

This code succssfully formats the date from a datetimepicker to the date format needed: (i.e. #2007-02-05# )

If you have successfully passed date values I would love to know what date format you used as the one I am attempting does not work.



 
Try this:

Instead of setting the date's format in code, select the DateTimePicker control, and in the Properties window set the Format property to "Custom". Then, under the CustomFormat property enter 'yyyy-MM-dd' (without the single quotes). This will format the date the way you want it. See if this helps and if it doesn't, then post back.



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day! Ye has a choice: talk like a pira
 
Thanks for the reply. I'll try it out and get back to you.
 
No go on formatting the datetimepicker. regardless of the format I try to pass ( need #2007-2-13#) I end up with #2/13/2007#. Can I even pass the correct format with a DTP, or maybe I need to have the user enter the date in a textbox.......

The stringvalue dates I am passing work great. Is there another change I need to make to the parameter variables to get them to accept a date format????
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top