AndrewWolford
MIS
Hi all,
I have a sub routine that takes a date from a field in a table and converts it to the proper date format and copies it back to the field. My date comes in this format: "20031231" and gets copied back as "12/31/2003" The field is dbText. here is the code I have:
Do Until rst2.EOF
tmpDate = rst2.Fields(TDarray(2, i))
If tmpDate <> 0 Then
fxdDate = Mid(tmpDate, 5, 2) & "/" & Mid(tmpDate,7,2)
& "/" & Left(tmpDate, 4)
Else
fxdDate = 0
End If
rst2.Edit
rst2.Fields(TDarray(2, i)).Value = fxdDate
rst2.Update
rst2.MoveNext
Loop
rst2.Fields(TDarray(2, i)).Type = dbDate 'this is where I'm
'trying to change the field type.
After I've copied the dates back in the correct format I want to change the field type to dbDate. I guess all I'm really asking is how can you change the field type from text to date in code? Is this possible?
Thanks for any help!
-Andrew
I have a sub routine that takes a date from a field in a table and converts it to the proper date format and copies it back to the field. My date comes in this format: "20031231" and gets copied back as "12/31/2003" The field is dbText. here is the code I have:
Do Until rst2.EOF
tmpDate = rst2.Fields(TDarray(2, i))
If tmpDate <> 0 Then
fxdDate = Mid(tmpDate, 5, 2) & "/" & Mid(tmpDate,7,2)
& "/" & Left(tmpDate, 4)
Else
fxdDate = 0
End If
rst2.Edit
rst2.Fields(TDarray(2, i)).Value = fxdDate
rst2.Update
rst2.MoveNext
Loop
rst2.Fields(TDarray(2, i)).Type = dbDate 'this is where I'm
'trying to change the field type.
After I've copied the dates back in the correct format I want to change the field type to dbDate. I guess all I'm really asking is how can you change the field type from text to date in code? Is this possible?
Thanks for any help!
-Andrew