Trying to run a Function from a module and I get an error. However, I'm using the same code in another module except using a different table it it works. Which leads me to believe something is wrong with the table.
Here is my code:
Code:
'there is more code above this (just declaring working variables), I've just pulled the part I think is causing the problem
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("TEMPBILLtbl")
rs.MoveFirst
Do Until lastbillpaid = True
If rs.Fields(20) < 0 Then 'check if workingpayoff is negative
'more code below this
It's bugging on the highlighted line saying Run-time Error 3021 - No Current Record, but I have tested to see if the table is there and it is.
I placed "msgbox rs.Fields(20)" after "rs.MoveFirst" and it gives me the correct value from the first record.
Any help would be greatly appreciated.