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 » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Importing CSV File to Access Table



 
 
Thread Tools Display Modes
  #1  
Old June 12th, 2008, 03:45 PM posted to microsoft.public.access.tablesdbdesign
PeteVTX
external usenet poster
 
Posts: 32
Default Importing CSV File to Access Table

Can anyone help?

Our Network Switch produces a range of traffic reports in CSV format -
however we need to manipulate this data in Access. Therefore I need to import
one of the CSV reports into an Access application that produces the results
we need. I know I can use the following to do this:

CurrentDb.Execute "Delete * from tbl_egressByZone"
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel3, _
"tbl_egressByZone", "C:\Documents and Settings\userName\Desktop\DT
Files\Egress By Zone.csv", True

However the CSV file contains 4 rows prior to the field heading rows that
are superfluous. Of course I can manually remove these rows from the CSV file
before I run the application but I wondered whether I could do this
automatically from within Access before importing the file.

Any help appreciated

Regards

Pete

  #2  
Old June 12th, 2008, 08:49 PM posted to microsoft.public.access.tablesdbdesign
Klatuu
external usenet poster
 
Posts: 7,074
Default Importing CSV File to Access Table

Is this working? Using TransferSpreadsheet on a csv file should produce an
error 3274.
You should be using the TransferText. With TransferText, you can specify
which columns to skip or import and define their names and data types.
What you do is go through the process once of doing a manual imort and after
you have chose the file, click on Advanced in the import wizard. There you
can set it up like you want it. The Click Save As and give the specification
a name. Then in your code you can use the name of the specification and it
will import it like you want it.
--
Dave Hargis, Microsoft Access MVP


"PeteVTX" wrote:

Can anyone help?

Our Network Switch produces a range of traffic reports in CSV format -
however we need to manipulate this data in Access. Therefore I need to import
one of the CSV reports into an Access application that produces the results
we need. I know I can use the following to do this:

CurrentDb.Execute "Delete * from tbl_egressByZone"
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel3, _
"tbl_egressByZone", "C:\Documents and Settings\userName\Desktop\DT
Files\Egress By Zone.csv", True

However the CSV file contains 4 rows prior to the field heading rows that
are superfluous. Of course I can manually remove these rows from the CSV file
before I run the application but I wondered whether I could do this
automatically from within Access before importing the file.

Any help appreciated

Regards

Pete

 




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 01:43 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.