Solved

Import excel dates into access

Posted on 2015-02-16
3
153 Views
Last Modified: 2015-02-16
Hello,

I have a process in MS Access that imports a downloaded CSV file into MS Access using docmd.TransferText, but the date fields are not recognized by Access. I've tried a couple of things to convert these dates, but nothing has worked so far. The imported date values look like this:

12-Feb-2015 08:12:28 PM EST
14-Feb-2015 02:57:23 PM EST

I'm importing the list into a working table, and the field to receive that date value is of type Text; I tried setting it to date/time, but then access just refused to import that fields' data. I then added an extra field at the end of the working table and have tried various formats and functions to manually push the date into that field, but I always get an error about mismatched field types.

How can I format this date value so that I can sort these records chronologically?

Any help would be much appreciated!!!!

--J
0
Comment
Question by:CoastalData
  • 2
3 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40612308
create a query with this column
assuming the field name is dteField

select dteField, cdate(left([dteField], instr([dteField], " ")-1)) as YourDate
from tableName
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 40612328
another way is to remove the "EST" from the text date
you can do this with an update query

update tableName set [dteField]=Replace(dteField," EST","")
0
 
LVL 3

Author Closing Comment

by:CoastalData
ID: 40612658
Aha! You nailed it... it's just the " EST" that was keeping Access from recognizing the data as a date.

Thanks for your help!!!
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question