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

DateTime appears to be converted to String, how come?

Status
Not open for further replies.

roadrash

Programmer
Joined
May 17, 2005
Messages
12
Location
US
I am generating a Crystal 6.0 report. I cannot use any of the Date functions, such as Month(), Year() because it is expecting a Date/Datetime field. I have the fields defined as DateTime in SQL7. In Crystal, I have "Report Options" setting of "Convert Date-Time field to Date-Time, this way I still get my "Time". On File/Options/Reporting, I have the option "When reading data, Keep date-time type" turned on.

I have not taken a Crystal class to know all the in's and out's, but this should be intuitive.....what am I doing wrong?

Thank you for taking the time to read this,

 
I have seen these functions work with true DateTimes and Dates (but not datetime Strings like MS Access).

As a test, if you flip the switch in File - Report Options, and let it convert the report temporarily, does it allow you to use the functions? If not, then the data type isn't datetime. If it does, then what you can do is flip the switch back and create formulas to convert each dateTime to Date (there are functions that do that). Now apply the Date functions to the converted formulas instead of the fields.

BTW the difference between Option and Report Options is that the former is a global affecting the next new report, the latter affects the report currently open.

Ken Hamady-
 
I have similar problem.

I used query analyzer to develop my query and the query results are good with proper datetime field as datetime. When I copied the same query to Crystal SQL designer and ran the query, the datetime field changed into string. I found out this after I used the .qry file as data source in CR. Where is the problem that changed the datetime field as string. In SQL7 database, the field was defined as datetime type.

If it is a string field, I am not able to use it as datetime parameter.

Anybody knows why and how to fix the problem? I was trying to change the datetime string into datetime format field but I am not able to use the format field to be a parameter field.

Thanks,

Kimberly
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top