Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

read txt file and tokenize??

Status
Not open for further replies.

antdickens

Programmer
Nov 13, 2001
129
GB
Anyone have a sample piece of code which will let me read a line of text from a file and check it to see if it contains certain strings.

many thanks

Ant
 
From a text file? What kind? How delimited? How linked to Access? Will you ben importing it?

To check for strings, you need to look in help for InStr.

Craig
 
it will simply be a text file with one line in it. the values in this line will be serperated by commas.

ceehrs

Ant
 
Ok.....

You need to get to set up an import specification for the file, use DoCmd.TransferText to import it, open a recordset based upon the new table, and use InStr to check.

Craig
 
A bit much?

Just open / read the whole enchillida into a string. Once the text is in a string, numerous functions (incl InStr) will locate the item for you.

I, personally, like to use Split (or basSplit for ver '97) as it not only "locate" the string, but actually seperates it from all else in the text file. Used with Join (or basJoin), it can easlily be used as a poor man's search ad replace.


MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top