D
D. Stacy
Objective: Convert txt data representing a time stamp on a particular
activity into DateTime format.
1. If the data field contains any data convert it to the DateTime format
2. If data field is Null or a zero length string would like to return a null.
3. The data usually come in 0000 format but it could be 000 or 00 or 0 or “ “.
CutT_temp:
CDate(IIf(IsError(FormatDateTime(IIf(Len([Cut_Time])<1,"",Left([Cut_Time],2)+":"+Right([Cut_Time],2)),0)),"",FormatDateTime(IIf(Len([Cut_Time])<1,"",Left([Cut_Time],2)+":"+Right([Cut_Time],2)),0)))
The expression works fine if the original txt field contains normal
(expected) data but returns an #Error if field starts with a zero length
string or a null.
activity into DateTime format.
1. If the data field contains any data convert it to the DateTime format
2. If data field is Null or a zero length string would like to return a null.
3. The data usually come in 0000 format but it could be 000 or 00 or 0 or “ “.
CutT_temp:
CDate(IIf(IsError(FormatDateTime(IIf(Len([Cut_Time])<1,"",Left([Cut_Time],2)+":"+Right([Cut_Time],2)),0)),"",FormatDateTime(IIf(Len([Cut_Time])<1,"",Left([Cut_Time],2)+":"+Right([Cut_Time],2)),0)))
The expression works fine if the original txt field contains normal
(expected) data but returns an #Error if field starts with a zero length
string or a null.