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

problem with time field 1

Status
Not open for further replies.

HowardHammerman

Instructor
Oct 11, 2001
640
US
My client's database has a table of work tickets with four fields:
Startdate (datetime but the time portion is all zeros)
Starttime (Eight-character string field format hh:mm:ss)
Enddate (same format as startdate)
Endtime (same format as starttime)

I created a datetime variable in a formula as follows:

dateTimeVar xx := DateTimeValue (date({timesheet.startdate},timevalue({timesheet.starttime} );

This seemed to work for many records but then I got an error message, "Bad time value".

I scanned the records in a separate report and could not find anything wrong.

I solved the problem by converting the hours, minutes and seconds to numbers and then converting those variable to time.

QUESTION: Is there a way of traping bad data? Does crystal have the equivalent of "on error"?

Thanks in advance.

Howard Hammerman,
Crystal Training and Crystal Material
On-site classes and one-on-one coaching
Low-cost telephone/email support
 
There are these functions that test for date, time, numeric, null and return a True or False. The Crystal Help has good examples on how to use them for error trapping.

IsDate(
IsTime(
IsDateTime(
IsNull(
IsNumeric(
 


Really dumb to have EITHER date or time as string!!!
[tt]
dateTimeVar xx :=timesheet.startdate + timevalue({timesheet.starttime};
[/tt]


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top