keschuster
asked on
Strip comma, tabs, carriage returns, tabs etc from text field
I have a ver large database that I need to export to a tab delimited file for import into another system. The problem I have is there is a note field, and others, that have commas, tabs, quotes, tabs, carraige returns etc. in it. naturally this reaks havoc on a tab delimited file.
Is there a way to query or code against these fields to either remove them or replace them?
Is there a way to query or code against these fields to either remove them or replace them?
It appears that you only need to edit-out the tabs within the data elements of the table. The problem is that the tabs are your only problem. So, simply do a search and replace in each data column that contains tabs and replace the tabs with some other special character. You can then replace the special character with the tab after the export.
ASKER
I've figured this much out
UPDATE Parcel SET Parcel.[Property Name] = Replace([Property Name],Chr(13),"|")
checks for one character and replaces. there are 4 characters I need to check for across 4 or more fields.
Instead of running 4 queries against each of the 4 fields I'd like to code tthis into a function that I could have update all of these characters via a call from one query.
UPDATE Parcel SET Parcel.[Property Name] = Replace([Property Name],Chr(13),"|")
checks for one character and replaces. there are 4 characters I need to check for across 4 or more fields.
Instead of running 4 queries against each of the 4 fields I'd like to code tthis into a function that I could have update all of these characters via a call from one query.
Would you want to use | instead of tab to seperate your fields.
| is not a very common character and it is located on the same key as \.
| looks like I o l but it is neither.
Mike
| is not a very common character and it is located on the same key as \.
| looks like I o l but it is neither.
Mike
ASKER
normally I would but tab is a requirment
Add |
Replace all unwanted ones
Replace | with tabs.
Replace all unwanted ones
Replace | with tabs.
sorry, I didn't read your post fully. You already had | in mind.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Simple solution, basically iterate thru each char in the specified string and build up a new string by accepting those 0-9, a-z or A-Z ranges only.
ASKER
That looks about what I was thinking. How do you think this will perfom on 80k records with each record having 4 columns to be evaluated.
Well only one way to find out
My personal choice would be to create the whole code in vba. Create a recordset and iterate thru that.
My personal choice would be to create the whole code in vba. Create a recordset and iterate thru that.
you did not allow for spaces (Ascii 20)
ASKER
I ran the code and the speed was just fine. I do want to modify to look for specific characters and replace them with a space. But this is the right way to go