'Can't Assign to Array'

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table with values I need read into an array, and I keep getting
"compile error: can't assign to Array" even when I know the code has worked
on previous occasions. (I copied code for an array from a sub procedure that
does work, into a "trial" function, and it didn't work at that point.)

Am I missing something?? this is the last element of a pretty complex bit
of coding that needs to function, and it's frustrating me that something so
simple is what's holding up the process.

Copy of code snippet follows:


Set db = CurrentDb()
Set rst = db.OpenRecordset(SQL)
rst.MoveLast
NumRows = rst.RecordCount
rst.MoveFirst
ReDim Team(0 to NumRows)

Team = rst.GetRows(NumRows)
rst.Close

Team is the variable indicated that cannot be set to an array - (it'd dimmed
as a variant) I don't know what's wrong!

Amanda
 
Get rid of the ReDim Team(0 to NumRows)

GetRows will dimension the variant appropriately.
 
Back
Top