Seperating string into table rows

usurper4

Board Regular
Joined
Mar 30, 2005
Messages
90
I know this seems stupid...but bear with me. We run reports from a database that come out as a long string of names, separated by a semicolon and a space (ex: bob davis; dave davis).

These strings can be upwards of 2000 names long.

Now, the stupid part: how can I use Access to pull this list into a table that has just one field (Name) and populate all 2000-whatever rows?

I can't figure this out for the life of me, and I know it's something simple.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Here's a manual-ish method.

Assuming that the huge string is in a text file, open that file in Word.
Replace semi-colon space with ^p (return)
Place the field name at the top of the list
Close and save the file, still in .txt format

You should now have a column of names that can be imported into Access.

Denis
 
Upvote 0
Okay, that's a little bit of a "duh" moment. Now, I'll just automate Access to do that for me in Notepad and I should be good to go!
 
Upvote 0
Why not just use the Split function with the ; as a delimiter?
 
Upvote 0
Okay, so how would I use this in this case? Do you have any VBA that just pulls a string from a text file and splits it? That's something I haven't been able to do.
 
Upvote 0
usurper4

Sorry I'm confused.:o

In the first post you mentioned a report, now you mention a text file.

Which is it?
 
Upvote 0
Well you can easily read a text file using VBA.

For example.
Code:
Sub test()
Dim strInput
Dim arrNames
Dim FF
Dim I
    FF = FreeFile()
    
    Open "C:\SplitTest.txt" For Input As FF
        Line Input #FF, strInput
    Close #FF
    
    arrNames = Split(strInput, ";")
    
    For I = LBound(arrNames) To UBound(arrNames)
        MsgBox arrNames(I)
    Next I
End Sub
 
Upvote 0

Forum statistics

Threads
1,222,398
Messages
6,165,765
Members
451,985
Latest member
jchunowitz

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