Convert a data type using a macro
Posted on 2004-09-07
I'm using an Access data base to return all accounts that haven't been loggeg into in over 90 days. The data is imported from a text file and comes in as text. (most have the last login time as m/d/yyyy h:mm am/pm, but some accounts come in as "Never")
So far I've been changing all the "Never"s to 1/1/1901 using an update query then I've been manually changing the data type in the table definition to date so that my query will run. This works, and it includes all my "Never" accounts, which is good.
However, I am trying to automate the process. I want to be able to import the data then just execute my query without having to manually manipulate the data types (this also means that I have to reset them back to text to import data again the next time around.) And if possible I would prefer to leave everything as text so that I don't have to convert the "Never"s to dates.
Can I do this with a macro, or in VB?