Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 31st, 2004, 04:42 PM
Authorized User
 
Join Date: Jan 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Any File (input #1) experts help?

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?

 
Old January 31st, 2004, 05:47 PM
Authorized User
 
Join Date: Jan 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Scrub that - Ive discovered FSO readline. Yipeee!

 
Old February 2nd, 2004, 08:35 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

For Info, you could use "Line Input #1, impGetString" instead.





Similar Threads
Thread Thread Starter Forum Replies Last Post
No input file specified stephen_c_ Beginning PHP 3 January 27th, 2006 10:00 PM
input type file darkhalf Javascript 1 October 29th, 2005 02:17 AM
input:output file ct ASP.NET 1.0 and 1.1 Basics 1 September 27th, 2005 09:43 AM
input file... joeore BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 2 February 23rd, 2004 07:58 PM
Multiple file input single file output.... jdm_mboy Biztalk 1 July 2nd, 2003 03:35 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.