Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creat a Macro to.......

Status
Not open for further replies.

jaycap78

MIS
Apr 24, 2002
1
US
I would like to create a macro to change a data type in a table from text to date/time. Is this possible? If so, how do I do it?

Here is why I need it.

I have created a macro that deletes a table and creates a new table from a csv file. When I import the csv file to create the table, I need to import all the fields as text, otherwise some data is lost. Then I have to go in and change a field within the table to date/time from text. I just want to automate this process. I have automated the delete and import of the table, but I have not been able to automate the changing of the data type.

Any help anyone can provide whould be greatly appreciated.

Thanks in advance,
Jay
 
I think it would be better for you to make your table permanent and set field to date/time type. Then instead of deleting table before import, clear it using delete query.

The import should then automatically convert values for the field to date/time.
You might also look at import specifications.

If no spec, Access will guess the correct type from the first few records in import file, which can lead to errors further along import if data does not agree with guessed type.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top