Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SubScript Out Of Range when filling multi-d array

Status
Not open for further replies.

jackiev

MIS
Aug 16, 2000
56
US
Help Please!!
Can you see what is WRONG with this code??

dim arrSchedules() as string
dim intx,inty as integer
(also have databases & recordsets declared)

'fill Schedules array
Set rsDailyLabor = dbPayroll.OpenRecordset("Select * from Schedules", dbOpenDynaset)
rsDailyLabor.MoveLast
intX = rsDailyLabor.RecordCount '(there are 14 recs)
intY = rsDailyLabor.Fields.Count '(there are 3 fields)
ReDim arrSchedules(intX, intY) 'SHOULD BE 14,3
rsDailyLabor.MoveFirst
intX = 0
While Not rsDailyLabor.EOF
arrSchedules(intX, 0) = CStr(rsDailyLabor.Fields("Key").Value)
arrSchedules(intX, 1) = CStr(rsDailyLabor.Fields("InTime").Value)
arrPayRules(intX, 2) = CStr(rsDailyLabor.Fields("OutTime").Value) '***ERRORS HERE AT (5,2)
intX = intX + 1
rsDailyLabor.MoveNext
Wend
Set rsDailyLabor = Nothing


ANY HELP WOULD BE APPRECIATED!!
 
arrPayRules(intX, 2) = CStr(rsDailyLabor.Fields("OutTime").Value) '***ERRORS HERE AT (5,2)


arrPayRules(intX, 2) where is that array dont you want
arrSchedules(intX, 2) instead


Hope this helps!!
Hungoverhippie
 
THAT'S IT!!!!
I think it is time for me to call it quits today.
Sloppy cut & paste....
It's amazing how another set of eyes can see the light.
Thank you.
 
Glad I could Help maybe you can take a quick look at my question posted called String Help Rephrase see if you can see what I am missing .. :)

Thanks
Hungoverhippie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top