Original:
Using VB6
If rsCardEvent(4).Value = Str Then TimOut = rsCardEvent(4) Else TimeOut = Left(TimOut, 2) & ":" & Mid(TimOut, 3, 2) & ":" & Right(TimOut, 2) End If
Getting Type MisMatch Error. How To Find Record Set Value is String or Number
Exactly i need
If Number means print number like Time Format (HH:MM:SS) else print string value
Coding Help for the above condition
Edited Version:
I'm working with an ADO.Recordset
object and am trying to determine the data type of a column at run-time. I need to handle the column value differently in my code depending on its underlying data type. If the column value is a string, I want to work with the value as-is. If it is a number, I want to treat the number as an packed time and convert it to HH:MM:SS
format (i.e. the number 120537
would be converted to the string "12:05:37"
).
Below is some example code that demonstrates what I want to achieve. However, when I run this code I get a "Type Mismatch" error:
If rsCardEvent(4).Value = Str Then
TimOut = rsCardEvent(4)
Else
TimeOut = Left(TimOut, 2) & ":" & Mid(TimOut, 3, 2) & ":" & Right(TimOut, 2)
End If