I am attempting to create a very simple function that will call another iteratively from within a loop in the main function. I keep getting a runtime error 9 whenever I try to call the function from my immediate window. I am at a loss to explain why this is so. Could someone enlighten me as to the nature of the problem with my code? Thanks!
Function atstonts()
Dim rs As DAO.Recordset
Dim jobno As String
Dim dept As String
Dim fats As Long
Dim tats As Long
Dim sql As String
Dim adate As Date
sql = "SELECT * FROM FromToATS;"
Set rs = Application.CurrentDb.OpenRecordset(sql)
rs.MoveFirst
Do While Not rs.EOF
ajobno = rs!jobno
adept = rs!dept
fats = rs!fromats
tats = rs!toats
fsec = rs!fromsec
tsec = rs!tosec
If IsNull(rs!dt) Then
adate = Date
Else
adate = rs!dt
End If
Call updateNTS(fats, tats, jobno, dept, adate)
rs.MoveNext
Loop
rs.Close
End Function
Function atstonts()
Dim rs As DAO.Recordset
Dim jobno As String
Dim dept As String
Dim fats As Long
Dim tats As Long
Dim sql As String
Dim adate As Date
sql = "SELECT * FROM FromToATS;"
Set rs = Application.CurrentDb.OpenRecordset(sql)
rs.MoveFirst
Do While Not rs.EOF
ajobno = rs!jobno
adept = rs!dept
fats = rs!fromats
tats = rs!toats
fsec = rs!fromsec
tsec = rs!tosec
If IsNull(rs!dt) Then
adate = Date
Else
adate = rs!dt
End If
Call updateNTS(fats, tats, jobno, dept, adate)
rs.MoveNext
Loop
rs.Close
End Function