The dictionary approach is a good one. The only problem that's come up
is the dictionary is defined during the retrieval of the data from a
database. After I populate it, I close the database and open up others
to retrieve other data. At the end of it all I need to use the data
from the dictionary. Apparently the keys remain but the items
disappear after I close the database. Since I don't totally understand
dictionaries, the items were a pointer to the rs() field in the
database which couldn't be resolved after the database was closed. So
I stored the data in an array and populated the dictionary after the db
was closed. It seems to work now. Thanks
Quote:
> This is a multi-part message in MIME format.
> ------=_NextPart_000_0452_01BF52BF.092DF060
> Content-Type: text/plain;
> charset="Windows-1252"
> Content-Transfer-Encoding: quoted-printable
> Why not use a Scripting.Dictionary object instead of arrays?
> One would hold the questions, indexed by (string) name. The other
would =
> hold the answers indexed by question name. =20
> Or use one dictionary indexed by question name where each dictionary =
> item is a 2 element array with element 0 the question text and
element 1 =
> the answer. =20
> Or...
> --=20
> Michael Harris
> It's implemented as an array. I have a series of questions stored
in =
> a
> database and each question has a name. The names of the questions
are
> stored in the array. After supplying the name I want to find out
its
> location in the array. I expected there to be a Find or search or
> Locate function. My array is about 70 long. I'm lucky it's not a
lot
> longer.
> > If you implemented the characters in a string, you could short cut
> > CONST MYSTRINGS=3D"abcdefghi"
> > Pos =3D Instr(MYSTRINGS, "e") ' should return 5
> > > What's the VB function for finding the location of a string in
an
> array?
> > > myarray=3D("a","b","c","d","e","f","g","h","i","j")
> > > If I'm looking for "e", I want 4 returned.
> > > Sent via Deja.com http://www.deja.com/
> > > Before you buy.
> Sent via Deja.com http://www.deja.com/
> Before you buy.
> ------=_NextPart_000_0452_01BF52BF.092DF060
> Content-Type: text/html;
> charset="Windows-1252"
> Content-Transfer-Encoding: quoted-printable
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META content=3D"text/html; charset=3Dwindows-1252" =
> http-equiv=3DContent-Type>
> <META content=3D"MSHTML 5.00.2919.6307" name=3DGENERATOR>
> <STYLE></STYLE>
> </HEAD>
> <BODY bgColor=3D#ffffff>
> <DIV><FONT size=3D2>Why not use a Scripting.Dictionary object instead
of =
> arrays?</FONT></DIV>
> <DIV> </DIV>
> <DIV><FONT size=3D2>One would hold the questions, indexed by (string)
=
> name. =20
> The other would hold the answers indexed by question name. =
> </FONT></DIV>
> <DIV><FONT size=3D2></FONT> </DIV>
> <DIV><FONT size=3D2>Or use one dictionary indexed by question name
where =
> each=20
> dictionary item is a 2 element array with element 0 the question text
=
> and=20
> element 1 the answer. </FONT></DIV>
> <DIV><FONT size=3D2></FONT> </DIV>
> <DIV><FONT size=3D2>Or...</FONT></DIV>
> <DIV><BR>-- <BR>Michael Harris</DIV>
> <DIV> </DIV>
> <DIV><BR> </DIV>
> <BLOCKQUOTE=20
> style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-
RIGHT: =
> 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
> <DIV><<A =
> =
Quote:
> m</A>...</DIV>It's=20
> implemented as an array. I have a series of questions stored
in=20
> a<BR>database and each question has a name. The names of the =
> questions=20
> are<BR>stored in the array. After supplying the name I want
to =
> find out=20
> its<BR>location in the array. I expected there to be a Find
or =
> search=20
> or<BR>Locate function. My array is about 70 long. I'm =
> lucky it's=20
> not a lot<BR>longer.<BR><BR>In article <<A=20
> =
Quote:
> q.edu.au</A>>,<BR> =20
> "Chui Tey" <<A =
> could short=20
> cut<BR>><BR>> CONST MYSTRINGS=3D"abcdefghi"<BR>> Pos =3D =
> Instr(MYSTRINGS,=20
> "e") ' should return 5<BR>><BR>> <<A=20
wrote =
> in=20
> message<BR><A=20
> =
o=
Quote:
> m</A>...<BR>>=20
> > What's the VB function for finding the location of a string
in=20
> an<BR>array?<BR>> >=20
> myarray=3D("a","b","c","d","e","f","g","h","i","j")<BR>> > If
=
> I'm looking=20
> for "e", I want 4 returned.<BR>> ><BR>> ><BR>> =
> ><BR>>=20
> > Sent via Deja.com <A=20
> href=3D"http://www.deja.com/">http://www.deja.com/</A><BR>> >
=
> Before you=20
> buy.<BR>><BR>><BR><BR><BR>Sent via Deja.com <A=20
> href=3D"http://www.deja.com/">http://www.deja.com/</A><BR>Before
you=20
> buy.</BLOCKQUOTE></BODY></HTML>
> ------=_NextPart_000_0452_01BF52BF.092DF060--
Sent via Deja.com http://www.deja.com/
Before you buy.