Loop

  • Thread starter Thread starter Jason Frazer
  • Start date Start date
J

Jason Frazer

I have a loop. I want to declare and define variables in the loop. What
I'm trying to do is extract data form a string. the string will look
something like this "Image1, Image2, Image3" I want to set POS1 = Image1,
POS2=Image2, and POS3= Image3. I am trying to do this using the InStr and
Mid functions.

The varable i want to define and declare starts with POS1 and goes until the
loop ends. For evertime the loop starts over i want the POS# in increase by
one.

How can i do this?

Thanks
Jason
 
Jason said:
I have a loop. I want to declare and define variables in the loop. What
I'm trying to do is extract data form a string. the string will look
something like this "Image1, Image2, Image3" I want to set POS1 = Image1,
POS2=Image2, and POS3= Image3. I am trying to do this using the InStr and
Mid functions.

The varable i want to define and declare starts with POS1 and goes until the
loop ends. For evertime the loop starts over i want the POS# in increase by
one.


Looks like a good time to use an array:

Dim POS(100) As String

then each time around the loop you can assign the strings to
an element in the array:

POS(k) = Mid(thestring, startpos, length)

In later versions of Access, you can use the Split function
to do all this for you.
 
Back
Top