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

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
 
A

Andreas

Are there always 3 words?
What is the exact format of the line (as seen in Notepad)?

Regards,
Andreas
 
A

Andreas

Depending on the version of Access, there are different ways of doing
this. The newer version have got some extra functions which are useful.
Since I don't have Access on this PC, I can't look at my samples or the
online help. But I'll get you started anyway.

1)
This is varying length text, you might need the LineInput rather than
the Input (check help).

2) Once you have the full text in a string variable (say strOriginal),
you need to split it into the 3 parts, something like this:

lngSpace1 = InStr(strOriginal, " ", 1)
lngSpace2 = InStr(strOriginal," ", lngSpace1 + 1)
strLeft = Left(strOriginal, lngSpace1 - 1)
strMiddle = Mid(strOriginal, lngSpace1 + 1, lngSpace2 - lngSpace1 - 1)
strRight = Mid(strOriginal, lngSpace2 + 1)

Regards,
Andreas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top