A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Importing Text Problem



 
 
Thread Tools Display Modes
  #1  
Old July 13th, 2009, 08:48 PM posted to microsoft.public.access.gettingstarted
Bre-x
external usenet poster
 
Posts: 103
Default Importing Text Problem

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


  #2  
Old July 13th, 2009, 09:03 PM posted to microsoft.public.access.gettingstarted
John Spencer
external usenet poster
 
Posts: 7,815
Default Importing Text Problem

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

Bre-x wrote:
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


  #3  
Old July 13th, 2009, 09:35 PM posted to microsoft.public.access.gettingstarted
Bre-x
external usenet poster
 
Posts: 103
Default Importing Text Problem

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!!!





"Bre-x" wrote in message
...
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




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:12 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.