If Option1.Value = True Then
' Obtener los records o valores.
Set qdef = db.CreateQueryDef("", "SELECT Cantidad , Muestra FROM Tabla")
Set rs = qdef.OpenRecordset(dbOpenSnapshot)
'Ver cuántos valores hay.
rs.MoveLast
NumPoints = rs.RecordCount
ReDim Values(1 To NumPoints, 1 To 2)
'Cargar los datos.
rs.MoveFirst
For i = 1 To NumPoints
Values(i, 1) = rs!Muestra
Values(i, 2) = rs!Cantidad
rs.MoveNext
Next i
'Dibujar gráfica
Chart.chartType = VtChChartType2dXY
Chart.Plot.Axis(VtChAxisIdX).AxisTitle.Text = "Muestras [n]"
Chart.Plot.Axis(VtChAxisIdY).AxisTitle.Text = "Cantidad"
Chart.TitleText = "Cantidad de piezas"
Chart.RowCount = NumPoints
Chart.ColumnCount = 2
Chart.ChartData = Values
End If