Error argument not optional occurs at Call getCalendarData
How to make your code work? Function getCalendarData(employeeID As Long) As Boolean
Dim rs As DAO.Recordset
Dim strDate As String
Dim strCode As String
Dim strSQL As String
Dim i As Integer
'// setup sql to retrieve one employee's attendance
strSQL = "SELECT * From t_employeeAttendance WHERE employeeID = " & employeeID
Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenSnapshot)
Set colCalendarDates = New Collection
With rs
If (Not .BOF) Or (Not .EOF) Then
.MoveLast
.MoveFirst
End If
If .RecordCount > 0 Then
For i = 1 To .RecordCount
strDate = .Fields("attendanceDate")
strCode = .Fields("statusCode")
colCalendarDates.Add strCode, strDate
.MoveNext
Next i
End If
.Close
End With
'// return date collection
Set rs = Nothing
End Function
How to make your code work? Function getCalendarData(employeeID As Long) As Boolean
Dim rs As DAO.Recordset
Dim strDate As String
Dim strCode As String
Dim strSQL As String
Dim i As Integer
'// setup sql to retrieve one employee's attendance
strSQL = "SELECT * From t_employeeAttendance WHERE employeeID = " & employeeID
Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenSnapshot)
Set colCalendarDates = New Collection
With rs
If (Not .BOF) Or (Not .EOF) Then
.MoveLast
.MoveFirst
End If
If .RecordCount > 0 Then
For i = 1 To .RecordCount
strDate = .Fields("attendanceDate")
strCode = .Fields("statusCode")
colCalendarDates.Add strCode, strDate
.MoveNext
Next i
End If
.Close
End With
'// return date collection
Set rs = Nothing
End Function