开发者

how to speed up with csv and access

开发者 https://www.devze.com 2023-04-03 10:58 出处:网络
There are over 210,000 records in a txt file. One record has three columns with space split. To import this file into ms access, system replace spaces into comma. And then using insert into, system im

There are over 210,000 records in a txt file. One record has three columns with space split. To import this file into ms access, system replace spaces into comma. And then using insert into, system imports all开发者_JS百科 at once. System needs to sort and search with these records. The whole processing time is so slow. It takes over 15 minutes. How to speed up?

  1. Is it able to handle over 210,000 records in a table of ms access 2003?
  2. Without replacing comma, could we import this txt file into access?

Thank you.


Access can import a text file which uses spaces instead of commas as the delimiter. On the first page of the Access 2003 "Import Text Wizard", choose the radio button next to "Delimited - Characters such as comma or tab separate each field". Click "Next", and on the next wizard page, select the radio button next to "Space" under the "Choose the delimiter that separates your fields" heading.

You can save your import choices as an "Import Specification" by click the "Advanced..." button to bring up the Import Specification dialog, then clicking the "Save As..." button on the right. Assign a Specification Name in the "Save Import/Export Specification" dialog and click OK.

If you want to do this type of import operation with code, you can use the TransferText method:

DoCmd.TransferText acImportDelim, "Your Named Specification", _
    "Destination Table Name", "C:\somepath\yourfile.txt"

See Access' help topic for more details about the TransferText method.

I noticed your question includes a vb6 tag, but don't know how that fits in. Seems to me that using TransferText from VBA to import a text file of 210K rows of 3 columns should not take anywhere near 15 minutes.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号