Log in

View Full Version : Type Mismatch in array



firemonkey
06-19-2013, 04:06 AM
I am trying to fill an array with data from a table in access and keep getting a type mismatch even though it is defined as a variant. (See below) I would appreciate some assist here as I cannot see what the issue is??
I know it is picking up the first row in the table because if you remove the '0' from '(0)' the code errors but the first string of data is displayed.
___
Dim dbsDB As DAO.Database
Dim rstTable As DAO.Recordset
Dim arrARRAY() as variant
Dim intRow As Integer

intRow = 0

Set dbsDB = CurrentDb
Set rstTable = dbsDB.OpenRecordset("Table")
rstTable.MoveFirst
Do Until rstTable.EOF
arrARRAY(intRow) = rstTable!Field(0):dunno
rstTable.MoveNext
intRow = 0 + 1
Loop

rstTable.Close
Set rstTable = Nothing
dbsDB.Close
Set dbsDB = Nothing
______

SamT
06-24-2013, 06:33 PM
I don't know Access but in VBA

Dim arrARRAY(1) as variant
'
'
'
ReDim Preserve ArrARRAY(intRow)
arrARRAY(intRow) = rstTable!Field(0)

firemonkey
06-24-2013, 08:21 PM
Thanks, will look for an equivalent.