D
Dale
Hi all,
I'm using this subroutine to call an excel function to calculate the 90th
percentile
within Access on a dataset of >437,000 records. The sub works with a
limited
number of records but on 437,000 records fails with a runtime error 13 "type
mismatch"
at line " dblResult = appXL.Application.Percentile((dblArray()), 0.9) ".
Is there a limitation to the number of records Excel can handle i.e. is
the limitation still 65,000 rows even though the call is from within the
database?
Thank you..Dale
Sub ExcelFun()
Dim appXL As Excel.Application
Dim dbs As Database, rst As Recordset
Dim strSQL As String, intI As Long
Dim dblArray() As Double, dblResult As Double
' Create SQL string.
strSQL = "SELECT [result] FROM [InLab];"
' Return reference to current database.
Set dbs = CurrentDb
' Open dynaset-type recordset.
Set rst = dbs.OpenRecordset(strSQL)
' Populate recordset.
rst.MoveLast
' Return to beginning of recordset.
rst.MoveFirst
' Redimension array based on recordset size.
ReDim dblArray(0 To rst.RecordCount - 1)
' Populate array with values from recordset.
For intI = 0 To UBound(dblArray)
dblArray(intI) = rst![result]
rst.MoveNext
Next
' Create new instance of Excel Application object.
Set appXL = CreateObject("Excel.Application")
' Pass array to Excel's Median function.
dblResult = appXL.Application.Percentile((dblArray()), 0.9)
Debug.Print dblResult
' Close Excel.
appXL.Quit
' Free object variables.
Set appXL = Nothing
Set dbs = Nothing
End Sub
I'm using this subroutine to call an excel function to calculate the 90th
percentile
within Access on a dataset of >437,000 records. The sub works with a
limited
number of records but on 437,000 records fails with a runtime error 13 "type
mismatch"
at line " dblResult = appXL.Application.Percentile((dblArray()), 0.9) ".
Is there a limitation to the number of records Excel can handle i.e. is
the limitation still 65,000 rows even though the call is from within the
database?
Thank you..Dale
Sub ExcelFun()
Dim appXL As Excel.Application
Dim dbs As Database, rst As Recordset
Dim strSQL As String, intI As Long
Dim dblArray() As Double, dblResult As Double
' Create SQL string.
strSQL = "SELECT [result] FROM [InLab];"
' Return reference to current database.
Set dbs = CurrentDb
' Open dynaset-type recordset.
Set rst = dbs.OpenRecordset(strSQL)
' Populate recordset.
rst.MoveLast
' Return to beginning of recordset.
rst.MoveFirst
' Redimension array based on recordset size.
ReDim dblArray(0 To rst.RecordCount - 1)
' Populate array with values from recordset.
For intI = 0 To UBound(dblArray)
dblArray(intI) = rst![result]
rst.MoveNext
Next
' Create new instance of Excel Application object.
Set appXL = CreateObject("Excel.Application")
' Pass array to Excel's Median function.
dblResult = appXL.Application.Percentile((dblArray()), 0.9)
Debug.Print dblResult
' Close Excel.
appXL.Quit
' Free object variables.
Set appXL = Nothing
Set dbs = Nothing
End Sub