Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access 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 November 2nd, 2005, 02:08 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default Ignore Comma in Line Input

HELP!!!

I am reading in lines of data from a file. Occasionally the text within the line contains a comma, which is interpreted by Access as a delimiter. Is there someway that I can read an entire line in, and igore the commas. Hence my only delimiter is a new line?

I am currently using the following line to input a line...

Input #1, strLine

Thanks

Mike

Mike
EchoVue.com
__________________
Mike
EchoVue.com
 
Old November 2nd, 2005, 09:38 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

Mike,
Try this:

    Const ForReading = 1, ForWriting = 2, ForAppending = 3
    Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
    Dim fs, f, ts, s
    Set fs = CreateObject("Scripting.FileSystemObject")
    fs.CreateTextFile "c:\test1.txt" 'Create a file
    Set f = fs.GetFile("c:\test1.txt")
    Set ts = f.OpenAsTextStream(ForWriting, TristateUseDefault)
    ts.Write "Hello World, This is A test, For Mike, At Echovue"
    ts.Close
    Set ts = f.OpenAsTextStream(ForReading, TristateUseDefault)
    s = ts.ReadLine
    MsgBox s
    ts.Close


Modify this to read your file. Should eliminate delimination by commas.

Kevin

dartcoach
 
Old November 2nd, 2005, 09:41 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Thanks Kevin,

I'll give it a go in a sec - Would I be correct in assuming then, that it would still deliminate by line?

Thanks

Mike

Mike
EchoVue.com
 
Old November 2nd, 2005, 09:45 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

Mike,

It should.

Kevin

dartcoach
 
Old November 2nd, 2005, 10:16 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

It Works!!

Thanks both Kevin and Mike.

The problem is now I have to rewrite the code that was actually taking advantage of the comma delimiting! But that should be fairly easy.

Mike

Mike
EchoVue.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
using a one line input for array WHSCT C++ Programming 1 January 1st, 2008 06:17 PM
How to ignore namespaces in input xml file hanifa XSLT 2 February 14th, 2007 04:14 AM
comma delimited input.how to extract value&compare kvmreddy XSLT 2 April 13th, 2006 10:13 AM
Ignore this post...its crap! clandestine XML 4 May 31st, 2005 06:38 AM
delete/ignore empty column crmpicco Excel VBA 1 May 4th, 2005 08:01 AM





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