As of Monday a access document started producing a runtime error 3021.
I've tried googling how to fix this but can't figure out how to do it and have spent quite a few hours on this..
wondering if someone would be nice enough to lend some help.
When I run it in debug mode it references the rst.MoveFirst as the error.
here is the code:
msg = "Your new Schedule Year is: " & sched_year & Chr(10)
msg = msg & "The new Pay Period is: " & sched_period & Chr(10) & Chr(10)
msg = msg & "Click OK to create this schedule for" & Chr(10)
msg = msg & "all of your employees or Click CANCEL."
If MsgBox(msg, vbOKCancel) = vbCancel Then
str = "Select * From [Pay Period Dates] Where [Year_ID]=" & sched_year & " and [Pay Period]=" & sched_period
Set rst = dbs.OpenRecordset(str)
If rst.RecordCount = 1 Then
str = "Select * From [Employees] Where [DEP_ID]='" & Forms![Login Screen]![Department] & "' and [Status]<>'" & "Terminated" & "'"
Set emp = dbs.OpenRecordset(str)
Set post = dbs.OpenRecordset("Employees Hours")
If emp.RecordCount = 0 Then
msg = "No Employess found in database!"
MsgBox msg, vbCritical, "Auto Create New Pay Period"
Do Until emp.EOF
sched_date = rst![Start Date]
End_Date = rst![End Date]
sched_week = 0
Do Until sched_date > End_Date
Thanks so much for your time