Hi Friends

I am trying to show multiple series in chart control, which are run time user dependent, it is working for single series, but while selecting two are more fields as series it shows same values. code is given below please help me out to solve it.

*********************************
Private Sub Command1_Click()

imax = List2.SelCount


Dim rscount As Integer

Dim x() As Variant
Dim iRow As Integer
Dim fcount As Integer
fcount = rs.Count

'************** column adding***********

ReDim x(1 To fcount, 1 To imax + 1)

dataScale = 1

iRow = 1
rs.MoveFirst


For i = 1 To rs.Count
rname = rs.Fields(List1.Text).Value
x(i, iRow) = (rname)
rs.MoveNext
Next i
'*************** series adding**********

For iRow = 2 To imax + 1
Dim val As String
For j = 0 To List2.ListCount - 1
If List2.Selected(j) = True Then
val = List2.List(j)
rs.MoveFirst
For i = 1 To rs.Count
rname = rs.Fields(val).Value
x(i, iRow) = (rname) * dataScale
rs.MoveNext

Next i
End If
Next j
Next iRow
addChartData:
MSChart1.ToDefaults
Call addDataArray(MSChart1, x(), True)
End Sub
'********************adding data array*********
Public Sub addDataArray(MyChart As MSChart, ByRef MyDataArray() As Variant, resetGraph As Boolean)
Dim varChartType As Variant
MyChart.ChartData = MyDataArray

If resetGraph Then
Call FX_ResetMSChart(MyChart)
End If

End Sub
*************************************

*************************************
Public Sub FX_ResetMSChart(MyChart As MSChart)

Dim numSeries As Integer

With MyChart


.ChartType = VtChChartType2dBar
numSeries = .Plot.SeriesCollection.Count
For iCount = 1 To numSeries
.Plot.SeriesCollection(iCount).DataPoints(-1).EdgePen.VtColor.Set 0, 0, 0
Next iCount

' Turn off the background grids
.Plot.Axis(VtChAxisIdX).AxisGrid.MajorPen.Style = VtPenStyleNull
.Plot.Axis(VtChAxisIdY).AxisGrid.MajorPen.Style = VtPenStyleNull
.Plot.Axis(VtChAxisIdY2).AxisGrid.MajorPen.Style = VtPenStyleNull
.Plot.Wall.Pen.Style = VtPenStyleNull

.Backdrop.Fill.Brush.FillColor.Set 255, 255, 255
.Backdrop.Fill.Style = VtFillStyleBrush



End With

End Sub
****************************************