How to prevent unparsable records from importing

respree

Active Member
Joined
Apr 14, 2003
Messages
258
Hello all.

I am trying to import a .txt file from an external source (which happens regularly). Inevitably, I will get import errors due to unparsable records (usually, one of the fields in the source file has misplaced quotes, which is confusing Access).

Of course, Access reports these unparsable records into a separate table, but goes and head and imports them anyway to the table it creates when the import takes place.

Question: Is there a way (setting?) to prevent these unparsable records from being imported into the main file, while still reporting the errors in a separate table?

Any help or insight would be greatly appreciated.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Although I can imagine what your data looks like, can you post a few sample records?
 
Upvote 0
Sure, I'll be happy to. Here are two records from a .txt file that were unparsable.

"BRE","1481","Brent","Jungle Panel I "sharing Fun"","0"
"BRE","1482","Brent","Jungle Panel II "say Hello"","0"

Please note 2 quotes within the record (sharing fun, say Hello). Could even be a a single quote in the record.
 
Upvote 0
Hmmm,

See what you mean. If no one else answers then I'll have a look over the weekend. I assume that Jungle Panel 1 and say hello should be parsed as seperate fields?
 
Upvote 0
I would appreciate it. I'm not getting a lot of feedback, so I appreciate yours very much.

No, actually, the problem here is no a missing comma, its the extra quotes within the field. In these examples,

Jungle Panel I "sharing Fun"

should be read into one field as:

Jungle Panel I sharing Fun



"Jungle Panel II "say Hello""

should be read into one field as:

"Jungle Panel II say Hello"
 
Upvote 0
Hello,

Here's one possibility but it's not that slick.

When you import the file make sure that the Text Qualifier (on the second page of the Text Import wizard) is set to none. Then when you've imported your data do a Find and Replace replacing " with nothing.

Does that work for you?
 
Upvote 0

Forum statistics

Threads
1,221,526
Messages
6,160,341
Members
451,638
Latest member
MyFlower

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top