In the Access VBA forum as this is the app driving my code.
I have a irritating text import problem that probably has a cure.
Have a text file called imported.txt which I have NO control over the format of. From this I need to extract the data (the reason for going with vba and getting me old thinkin ed on). It is basically the exported contents of my music database and runs into some 16,000 items (hence the need for
vb intervention as the plain old import facility fails this nasty file).
Now Ive got my import from text file code working and near spot on for my needs but being a bit of a perfectionist in terms of detail.
The file concerned is exported as quote and semi-colon (I have NO control on this). This has been easy enough to deal with. However, if a song title or artist contains a comma (,) the file line reader goes tits up splitting the file in the wrong place.
Open "d:\data_projects\import.txt" For Input As #1
Do Until EOF(1)
Input #1, impGetString
tmpManip = CStr(impGetString)' force of habit - not really needed
' blah blah blah
' code that processes the line grabbed (tmpManip)
' blah blah blah
Loop
Close #1
If the variable grabs a line from the underlying text file containing a comma (,) it seems to think that it's the end of the line. Short of manually renaming the 2000 tracks that have commas in their names, albums or titles is there a way to control input # with a bit more precision!
Ive turned to my trusty pile of books from wrox & sams but it appears that it's all 'beyond the scope of the book' stuff. I am thinking along the lines of a function that handles the file at byte level extracting a line where it see's the [return]/[line feed] scenario. Any pointers from the pro's?