Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make variable names at runtime

Status
Not open for further replies.

raydenl

Programmer
Sep 22, 2003
22
NZ
Hi,

This is kinda driving me crazy. Is there any way to concat the value of a counter variable to a variable name to make a new variable name???

e.g.

values1
values2
values3

etc...

This is what I'm trying to do:

Code:
For i = 0 To (count - 1)
		ReDim values & i(numberOfCategories - 1)
	Next
		
	j = 0
	
	Do While Not rs.EOF
		For i = 0 To (count - 1)
			If rs("code") <> codes(i) Then
				values & i(j) = 0
			Else
				If IsNull(rs("price")) Then
					values & i(j) = 0 
				Else		
					values & i(j) = rs("price")
				End If
			End If

			rs.MoveNext
		Next
		j = j + 1
	Loop

	For i = 0 To (count - 1)
		Set objSeries(i) = objChart.SeriesCollection.Add()

		With objSeries(i)
			.Caption = codes(i)
			.SetData objConstants.chDimCategories, objConstants.chDataLiteral, categories
			.SetData objConstants.chDimValues, objConstants.chDataLiteral, values & i
		End With
	Next

The problems are:

- There can be any number of values arrays

- A 2-D array would work well, but the chDataLiteral for Office Web Components ONLY accepts a 1-D array or a comma delim list

Can anyone help me?
 
In VBScript you may consider the Execute statement.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top