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!

Bad date-time string format (basic syntax)

Status
Not open for further replies.

gshadz37

Technical User
Joined
Mar 21, 2005
Messages
102
Location
US
The formula below works most of the time, but occasionally I get a Bad date-time string format. I believe it only happens when {@SignOff} = 0, but I'm not sure how to handle that in the formula. I'm looking for a way to add something like if {@SignOff} = 0 then 0 else 'rest of formula'. I'm not sure how to go about this in Basic Syntax. Here is the current formula:

WhilePrintingRecords
global mtime As DateTime

Dim sONt As DateTime
Dim sOFFt As DateTime

sOFFt = DateTimeValue ({@SignOff})

if NextIsNull ({Reason Code Events.Time Stamp}) then
formula = HrsMinsSecs( DateTimeToSeconds (sOFFt) - DateTimeToSeconds(mtime))
else

sONt = DateTimeValue ({@SignOn})

if {Reason Code Desc.Reason Code Description} <> "SIGN OFF - END OF SHIFT" then
formula = HrsMinsSecs( (DateTimeToSeconds (sONt) - DateTimeToSeconds (sOFFt)) )
else
formula = HrsMinsSecs( DateTimeToSeconds (sOFFt) - DateTimeToSeconds(mtime))
end if

end if

Thaanks for any help!
 
Check the contents of the @signoff using:

if IsDateTime ({@SignOff}) then
sOFFt = DateTimeValue ({@SignOff})
else
<whatever default datetime you wish>

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top