Is there an easy way to read one word at a time ?

  • Thread starter Thread starter Fia
  • Start date Start date
F

Fia

Hi
I don't know if I express myself correctly put I wan't to read one word at a
time in the line I'm reading.

I know the code below doesn't work, but it's just to explain myself.
if the line read is "Kalle Pelle Nisse"
input #1, arr(0,1),arr(0,2), arr(0,3)
I wan't arr(0,1) to contain "kalle",arr(0,2) to contain "pelle" and arr(0,3)
to contain "nisse"

Thank's
greatful for code

Fia
 
What version of Access are you using? If you're using Access 2000 or
greater, you can use the Split function:

Dim arrTokens() As String
arrTokens = Split(YourString, " ")

Thus arrTokens would contain:
arrTokens(0) = "Kalle"
arrTokens(1) = "Pelle"
arrTokens(2) = "Nisse"

The syntax of Split is:

Split (StringToParse, Delimiter)

Thus if you had a comma-delimited string like "Bob, Sue, Sam" and wanted to
parse out the individual elements:

arrTokens("Bob, Sue,Sam", ",")
 
Back
Top