'Can't Assign to Array'

A

Amanda Payton

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
 
D

Douglas J. Steele

Get rid of the ReDim Team(0 to NumRows)

GetRows will dimension the variant appropriately.
 
A

Amanda Payton

Douglas -

Did that... didn't help... still having problems. Any other ideas?

Amanda
 
D

Douglas J. Steele

You sure NumRows is non-zero? And you're sure Team is declared as a variant?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top