Subject: "Subscript out of range" in acFormPivotChart
Posted By: jilly Post Date: 4/23/2008 8:52:44 PM
I have this Sub:

Public Sub MakeForm()
vSQLDatos = "select * from [ttemp];"
Dim rsSQLDatos As Recordset
Set rsSQLDatos = CurrentDb.OpenRecordset(vSQLDatos)

Set frm = CreateForm
frm.RecordSource = vSQLDatos

vLeft = 1000
For i = 0 To rsSQLDatos.Fields.Count - 1
    
    Set ctlText = CreateControl(frm.Name, acTextBox, acDetail, "", rsSQLDatos(i).Name, vLeft * i, 8, vLeft * 0.91, 250)
    ctlText.Name = rsSQLDatos(i).Name
    
Next i

Dim vArrayDatos(50) As Variant
Dim vArrayOtros(50) As Variant

    DoCmd.OpenForm frm.Name, acFormPivotChart
    
    vArrayDatosi = 0
    vArrayOtrosi = 0
    For i = 0 To rsSQLDatos.Fields.Count - 1
        If Right(rsSQLDatos(i).Name, 1) = "z" Then 'los datos, con los datos... y los números con los números
        vArrayDatos(vArrayDatosi) = rsSQLDatos(i).Name 'Para el array de los campos a incluir
        vArrayDatosi = vArrayDatosi + 1
        Else
        vArrayOtros(vArrayOtrosi) = rsSQLDatos(i).Name 'Para el array de los campos a incluir
        vArrayOtrosi = vArrayOtrosi + 1
       End If
    Next i

Set chConstants = Forms(Forms.Count - 1).ChartSpace.Constants
Set chartss = Forms(Forms.Count - 1).ChartSpace
    chartss.SetData chConstants.chDimValues, chConstants.chDataBound, "Agua Inyectada a piscinas Km3z" 
    chartss.SetData chConstants.chDimCategories, chConstants.chDataBound, vArrayOtros

End Sub


My problem is here:
    chartss.SetData chConstants.chDimValues, chConstants.chDataBound, "Agua Inyectada a piscinas Km3z"
I get "Subscript out of range".

I'm sure is because "Agua Inyectada a piscinas Km3z" plus "Suma de " has more than 24 characters long.

Any ideas how to solve it?

Thank you in advance!
Saludos.

Oh, I'm using "owc11.dll".


Go to topic 70831

Return to index page 1