DougTucker
Technical User
I need your help to automate the process to break a text field in MS Access(with multiple lines separated with the line break character) into separate columns. I've struggled for several days and have seen various code samples using the "Split" function, but nothing that exactly works.
Here's what I have:
1. Canned report that can be exported from a web page as Excel, BUT Excel is losing leading zeros on account numbers. I NEED the leading zeros (i.e., must be pulled in as TEXT and not number).
2. I can preserve the leading zeros by opening the file and saving as HTML, then importing into MS Access. This puts all the fields in the long text field into a single field that looks like this (no quotes in the original text):
COLUMN 1:
"Customer"
COLUMN 2 (5 fields concatenated with line breaks):
"Bob Smith
0001234
ACME Company
123 Main Street
Anywhere, USA"
The fields are always in the same place, so I want to parse it into separate columns (where "|" illustrates a column delimiter):
Bob Smith|0001234|ACME Company|123 Main Street|Anywhere, USA
What I envision is creating a function or procedure that spins through the table and breaks the values into separate columns in the same table. I can also use a query with calculated fields for each column (where I parse out [WholeString] into [StringPart1], [StringPart2]...[StringPart10] (there won't be more than 10 rows in the freeform text).
I'm fairly handly with MS Access, and a beginner at VBA.
Please reply with any further questions. Thanks in advance for your help.
- Doug T.
Here's what I have:
1. Canned report that can be exported from a web page as Excel, BUT Excel is losing leading zeros on account numbers. I NEED the leading zeros (i.e., must be pulled in as TEXT and not number).
2. I can preserve the leading zeros by opening the file and saving as HTML, then importing into MS Access. This puts all the fields in the long text field into a single field that looks like this (no quotes in the original text):
COLUMN 1:
"Customer"
COLUMN 2 (5 fields concatenated with line breaks):
"Bob Smith
0001234
ACME Company
123 Main Street
Anywhere, USA"
The fields are always in the same place, so I want to parse it into separate columns (where "|" illustrates a column delimiter):
Bob Smith|0001234|ACME Company|123 Main Street|Anywhere, USA
What I envision is creating a function or procedure that spins through the table and breaks the values into separate columns in the same table. I can also use a query with calculated fields for each column (where I parse out [WholeString] into [StringPart1], [StringPart2]...[StringPart10] (there won't be more than 10 rows in the freeform text).
I'm fairly handly with MS Access, and a beginner at VBA.
Please reply with any further questions. Thanks in advance for your help.
- Doug T.