I am uncertain what is causing this error and would like some help understanding what mistake I made which caused it as well as help or suggestions on how to correct the issue Below is a section of code that I am getting the error on. The debug flags up on line 7 "Feb = (Me.BillRate * DayNum) * Me.Util_"
Set dayRs = db.OpenRecordset("SELECT WrkDays FROM WrkDays ORDER BY WrkMonth;")
dayRs.MoveFirst
Set DayNum = dayRs.Fields("WrkDays")
While Not dayRs.EOF
Jan = (Me.BillRate * DayNum) * Me.Util_
dayRs.MoveNext
Feb = (Me.BillRate * DayNum) * Me.Util_
dayRs.MoveNext
Mar = (Me.BillRate * DayNum) * Me.Util_
dayRs.MoveNext
Apr = (Me.BillRate * DayNum) * Me.Util_
dayRs.MoveNext
May = (Me.BillRate * DayNum) * Me.Util_
dayRs.MoveNext
Jun = (Me.BillRate * DayNum) * Me.Util_
dayRs.MoveNext
Jul = (Me.BillRate * DayNum) * Me.Util_
dayRs.MoveNext
Aug = (Me.BillRate * DayNum) * Me.Util_
dayRs.MoveNext
Sep = (Me.BillRate * DayNum) * Me.Util_
dayRs.MoveNext
Oct = (Me.BillRate * DayNum) * Me.Util_
dayRs.MoveNext
Nov = (Me.BillRate * DayNum) * Me.Util_
dayRs.MoveNext
Dec = (Me.BillRate * DayNum) * Me.Util_
Wend
I am guessing based on how I built this code that I will very likely get a similar error on the lines of code which follow after the "Feb" line. So I want to understand this error more clearly so I can correct future occurances.
UPDATE After working with Hans he pointed me to using the recordset.getrows method which accomplished the same process that I was trying to do with less headache. So thank you very much Hans
Me.Util_
. Use of underscore is certain to create problems, including perhaps the one you are dealing with.Set DayNum = dayRs.Fields("WrkDays")
needs to go WITHIN theWhile
loop.dayRs.Fields("WrkDays")
presumably changes with each new record, so you have to get it fresh.