How do you read through a string in VB, and copy portions into another variable
eg
given the string "Name___:Helen No.___:1234"
how do you put, lets say recst.name="Helen" and recst.num="1234" (recst is just a recst)
Printable View
How do you read through a string in VB, and copy portions into another variable
eg
given the string "Name___:Helen No.___:1234"
how do you put, lets say recst.name="Helen" and recst.num="1234" (recst is just a recst)
If VBA will allow it you can use SPLIT
Dim MyArr() AS string
MyArr = Split("this:is:the:string",":")
.. will fill the array with
MyArr(0)= this
MyArr(1) = is
MyArr(2) = the ... etc etc
Without the SPLIT function you will need to play with the INSTR function ..
Dim StartPos as Integer
StartPos = Instr("This is: the string",":")
Startpos will return the position of the first ":" in the string. You can then use the left/right/mid commands to extract either side.
LeftStr = Left("This is: the string",StartPos)
RightStr = Mid("This is: the string",StartPos)