S
SlowLearner
First, Thanks for looking at this
Can't see why the following code returns "Object
Required" error. I have checked variable types and field
names several times.
Dim ActType() As Long, AcctNumber() As Long, I As Integer
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("tblAccounts", dbOpenDynaset)
Command = "Select * From tblAccounts"
rs.Requery
rs.MoveLast
rs.MoveFirst
'Redim the array
ReDim ActType(rs.RecordCount - 1)
ReDim AcctNumber(rs.RecordCount - 1)
I = 0
'Loop through the fields and assign values
For I = 0 To rs.RecordCount - 1
ActType(I) = rs.Fields("AccountType").Value
AcctNumber(I) = rs.Fields("AccountNumber").Value
rs.MoveNext
Next I
'close the recordset connection to the table
rs.Close
Set rs = Nothing
Any Suggestions?
Can't see why the following code returns "Object
Required" error. I have checked variable types and field
names several times.
Dim ActType() As Long, AcctNumber() As Long, I As Integer
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("tblAccounts", dbOpenDynaset)
Command = "Select * From tblAccounts"
rs.Requery
rs.MoveLast
rs.MoveFirst
'Redim the array
ReDim ActType(rs.RecordCount - 1)
ReDim AcctNumber(rs.RecordCount - 1)
I = 0
'Loop through the fields and assign values
For I = 0 To rs.RecordCount - 1
ActType(I) = rs.Fields("AccountType").Value
AcctNumber(I) = rs.Fields("AccountNumber").Value
rs.MoveNext
Next I
'close the recordset connection to the table
rs.Close
Set rs = Nothing
Any Suggestions?