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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|