[thelist] writing to existing array with VBScript

Joel D Canfield joel at spinhead.com
Tue Aug 14 20:08:08 CDT 2001


I'm creating an empty array, then looping thru the results of a database
query, writing the array elements as I go (for later use.) Here's what I've
got:

	aryEmps = Array()
	i=0
	Do While Not ListEmps.EOF
		strEmpID = ListEmps("EmpID")
		aryEmps(i) = strEmpID
		ListEmps.MoveNext
		i = i + 1
	Loop

I'm getting the expected results from my query, but this line

	aryEmps(i) = strEmpID

returns the error

	Type mismatch: 'aryEmps'

How do I write to the existing array values? I'm assuming I can say

	aryEmps(0) = "myNewValue"

to set it, increment the value in the parentheses, and loop, but I can't
find any comments on the exact syntax, so I could we way off.

Thanks.

Joel at spinhead.com





More information about the thelist mailing list