i am importing data from many text files which sometimes contain an error. These text files include dates, strings, and integers, but in order to make this program as hands-free as possible, i need to import all fields as text - in the event of an error in the text field, a field that is usually a date may actually turn out to be something like "12/2/20x[38475934f59dr.g pi9087304d0i". If i try to set the field in the destination table to accept nothing but dates, this will cause a run-time error, which requires human intervention (particularly mine).
Anyway, importing is no longer a problem, as long as i set everythng to text. However, I run into basically the same problem when i attempt to direct the data to its appropriate permanent table, as those must be "data-type" specific. Is there some function that can determine if a value is compatible with a variable type?
i.e. consider the pseudo-function:
From here, it would be easy to handle the error (a simple
would be sufficient)
It's the second line of code that is my question - is there a function already in VB or even a simple one I could write to test "If str 'can be a date'"
Anyway, importing is no longer a problem, as long as i set everythng to text. However, I run into basically the same problem when i attempt to direct the data to its appropriate permanent table, as those must be "data-type" specific. Is there some function that can determine if a value is compatible with a variable type?
i.e. consider the pseudo-function:
Code:
function CanBeDate(str) If str 'can be a date' then CanBeDate = True else CanBeDate = False End If End Function
Code:
if nz(dlookup(True,"[Table]","CanBeDate([Field])=False"),False) then goto handle_errors
It's the second line of code that is my question - is there a function already in VB or even a simple one I could write to test "If str 'can be a date'"
Comment