Hello,
I was wondering how you can change the data type in a field to Date/time rather then just text using VBA.
I assembled the following code, but am not getting any results. If someone could help me out I would appreciate it.
Table Name: tblATB_1
Field name to format: Due_Date
Data Type Desire: Date/Time
Format: MM-DD-YYYY
strSql = "ALTER TABLE tblATB_1 ALTER COLUMN Due_Date Date/Time;" CurrentProject.Connection.Execute strSql
Thank you in advance
Hi,
Click Here - to view Field Type References
and
Click Here - for some examples
Hope this helps,
Dan
"I am not a rocket scientist, I am a nuclear engineer." - Split_atom18
If my advice has been helpful to you, then please help me by clicking on the "Star" and adding to my reputation, Thanks!
Just my 0.02c worth.
I had a text field that held dates. I also had people from
Germany 04/07/2010
Japan 2010-07-04
China 2010/07/04
USA 07/04/2010
entering dates in this field. The problem that I was worried about is how Access or the database would deal with the above.
In the end I did this manually, be creating a new column with type Date. Then I opened a record set of all records and copied each one accross. If Access could not handle the string when putting it into the date field I would get an error and could then come back to fix them up. The US ones (where the day was greater than 12) errored in my case as my Database was sitting in Germany with a german date system. Also the ones less than 12 were also wrong.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks