Text to Columns in access ???????

unc2plo

Board Regular
Joined
Mar 18, 2002
Messages
148
I need help duplicating "text to columns" in access.

I have a database field that is 6 characters log. I need the field broken down into 3 columns depending on where the hyphen is.

I tried using Left & Right, but the problem is that in some cases the entire 6 characters are used up, and not in others, but the extra character space is still there.

Example:
Shifts
12-2-1
3-1-2

Is there some sort of VBA code that can do the breakouts based on teh hyphen vs character count?


Thanks,
David
 
Run-time error '9'.
Subscript out of range.

And this result (I just copied first lines):

Text | My Left | MyMiddle | MyRight
A1; A1; #Error #Error
Q5 Q5 #Error #Error
Q5- Q5
X4-Usluga X4 Usluga Usluga
X7-Kosten 2015 X7 Kosten 2015 Kosten 2015

How can you both get an error (for every line??) and get results?
The results showing #Error are because the text does not contain the delimiter.
 
Last edited:
Upvote 0

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
How can you both get an error (for every line??) and get results?
The results showing #Error are because the text does not contain the delimiter.

I think my answer got lost :-(

So I get a Visual Basic Pop up window. Saying:

Run-time error '9'.
Subscript out of range.

I have four options

Continue (it's grey and not clickable)
End (it keeps popin up the same error until the results appear)
Debug (it leads to VB-Editor where the line SplitField = Split(strValue, strDelimiter, , vbTextCompare)(intPartWanted - 1) is highlighted
Help (well...)
 
Upvote 0
I think my answer got lost :-(

So I get a Visual Basic Pop up window. Saying:

Run-time error '9'.
Subscript out of range.

I have four options

Continue (it's grey and not clickable)
End (it keeps popin up the same error until the results appear)
Debug (it leads to VB-Editor where the line SplitField = Split(strValue, strDelimiter, , vbTextCompare)(intPartWanted - 1) is highlighted
Help (well...)

I decided to do it another way just checking if my codes appear on the Text-Column so I will get a yes Column for every Code which was introduced. Now I am not sure how to make it appear as a list....

Maybe someone gives me an Idea. It is like I have such a list:

Name Clothing
Person A 01-03-90
Person B 01
Person C 03-01
Person D
Person E 90

And I separated it like this

Name Clothing 01 03 90
Person A 01-03-90 01 03 90
Person B 01 01
Person C 03-01 01 03
Person D
Person E 90 90


Now I want to have a list like this (where 01=Hut; 03=Bluse; 90= Shoes)


Name Clothing
Person A Hut
Person A Bluse
Person A Shoes
Person B Hut
Person C Hut
Person C Bluse
Person D
Person E Shoes


I don't know if I am thinking to complicated....
 
Upvote 0
Is your data in a text file? Changing Hyphens to spaces is about the same so nothing gained.
 
Upvote 0
Is your data in a text file? Changing Hyphens to spaces is about the same so nothing gained.

No, it was actually separated in columns it just looked like spaces because I copied it in here and the format looks different.
 
Upvote 0
What do you mean by columns? There are no columns in text files.
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,866
Members
452,948
Latest member
UsmanAli786

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