Importing Text Problem

  • Thread starter Thread starter Bre-x
  • Start date Start date
B

Bre-x

Hi,
I have a csv file with the following content

2009-07-13,34195,1,CI000139,3,A

When I import it into ms accesss with:

'Import Text File
file_name = "M:\Reorder\toolcrib\toolcrib.csv"
DoCmd.TransferText acImportDelim, "", "Temp", file_name, False, ""

the first column (2009-07-13) is imported as a date and change it to
'7/13/2009'

I dont want that to happen, I need this column to be imported as text and
as '2009-07-13'

Any ideas?

Thank you all!!!!!

Bre-x
 
Set up and save an import specification that defines the field types.

You can set up an import specification by doing a manual import

==File: Get External Data: Import
==Choose the text file
==Follow the on-screen instructnions
==Set up the field specifications
==Click the advanced button
==When you have the specifications set up click the Save As... button to save
the specification

Now when you use DoCmd.TransferText use the name of the import specification
as the second argument.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
John Spencer thank you for answering my post!!

But i decide to take another way.

Public Function mydate(the_date As String) As String
mydate = Format(the_date, "YYYY") & "-" & Format(the_date, "MM") & "-" &
Format(the_date, "DD")
End Function

Thank you again!!!
 
Back
Top