Many thanks MN
Much appreciated.
Rgds Laphan
MN <im***********@hotmail.com> wrote in message
news:ad**************************@posting.google.c om...
"Laphan" <ne**@FrozenMoles.co.uk> wrote in message
news:<be**********@sparta.btinternet.com>...
Hi All
Need another favour.
I have an Access memo field that contains a list of single random words
that are separated by a single space. What I need to do is extract a random
word from this list 8 times so that I can have the following to play with:
1stRandomWord.2ndRandomWord
3rdRandomWord.4thRandomWord
5thRandomWord.6thRandomWord
7thRandomWord.8thRandomWord
I doing a Access DB to ASP page, so any ASP-compliant VB example code
would be really appreciated.
Rgds
Laphan
Read you word list into a string variable and use the VB split
function to break the words apart at the " " character.
lstrWordList = lobjRst("<name of memo field>")
lstrWordArr = split(lstrWordList," ")
response.write(lstrWordArr(0) & "." & lstrWordArr(1) & "<br>")
Remembering that in VB(Script) array indexes start at 0.
If you want to make it more generic then ubound(<array variable name>)
can be used to get the upper bound of the array so you can do your
processing in a loop.
If the delimeter specified as argument 2 of the split function is not
found in the string the whole string will be in element 0 of the
array.
Enjoy.