Using the following code to populate with unique records, but I am receiving a Compile Error - Argument not Optional at the SQLOutput line, with the following code:
Private Sub Employee_AfterUpdate()
Dim dbs As Database
Dim qdfdef As QueryDef
Dim qdfTemp As QueryDef
Dim rst As Recordset
Set dbs = CurrentDb
Set qdfTemp = dbs.CreateQueryDef(""
SQLOutput "SELECT Absences.ID, Absences.Date, Absences.Details, Absences.Image, Absences.Employee"
FROM Absences
WHERE (((Absences.Employee) = [Forms]![EmployeeAbsenceCalendar]![Employee]))
qdfTemp
If Not ErrorCondition Then
m_bFoundFile = True
Else
m_bFoundFile = False
End If
If m_bFoundFile Then
If rst.RecordCount > 0 Then
rst.MoveFirst
Do While Not rst.EOF
HoldDate = rst!Date
HoldDetail = rst!Details
Me.ctCalendar1.DateText(HoldDate) = HoldDetail
Me.ctCalendar1.DateImage(HoldDate) = rst!Image
rst.MoveNext
Loop
End If
End If
Exit Sub
DBErrorHandler:
'MsgBox " Database not Found!"
ErrorCondition = True
End Sub
Function SQLOutput(strSQL As String, qdfTemp As QueryDef)
Dim rstEmp As Recordset
qdfTemp.SQL = strSQL
Set rstEmp = qdfTemp.OpenRecordset
Me.ctCalendar1 = rstEmp
rstEmp.Close
End Function
---------------------
The following code works okay if passed directly to the underlying table.
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("Absences"
If Not ErrorCondition Then
m_bFoundFile = True
Else
m_bFoundFile = False
End If
If m_bFoundFile Then
If rst.RecordCount > 0 Then
rst.MoveFirst
Do While Not rst.EOF
HoldDate = rst!Date
HoldDetail = rst!Details
Me.ctCalendar1.DateText(HoldDate) = HoldDetail
Me.ctCalendar1.DateImage(HoldDate) = rst!Image
rst.MoveNext
Loop
End If
End If
Exit Sub
DBErrorHandler:
'MsgBox " Database not Found!"
ErrorCondition = True
End Sub
---------------------
Could someone please advise what I have missed.
---------------------
Private Sub Employee_AfterUpdate()
Dim dbs As Database
Dim qdfdef As QueryDef
Dim qdfTemp As QueryDef
Dim rst As Recordset
Set dbs = CurrentDb
Set qdfTemp = dbs.CreateQueryDef(""
SQLOutput "SELECT Absences.ID, Absences.Date, Absences.Details, Absences.Image, Absences.Employee"
FROM Absences
WHERE (((Absences.Employee) = [Forms]![EmployeeAbsenceCalendar]![Employee]))
qdfTemp
If Not ErrorCondition Then
m_bFoundFile = True
Else
m_bFoundFile = False
End If
If m_bFoundFile Then
If rst.RecordCount > 0 Then
rst.MoveFirst
Do While Not rst.EOF
HoldDate = rst!Date
HoldDetail = rst!Details
Me.ctCalendar1.DateText(HoldDate) = HoldDetail
Me.ctCalendar1.DateImage(HoldDate) = rst!Image
rst.MoveNext
Loop
End If
End If
Exit Sub
DBErrorHandler:
'MsgBox " Database not Found!"
ErrorCondition = True
End Sub
Function SQLOutput(strSQL As String, qdfTemp As QueryDef)
Dim rstEmp As Recordset
qdfTemp.SQL = strSQL
Set rstEmp = qdfTemp.OpenRecordset
Me.ctCalendar1 = rstEmp
rstEmp.Close
End Function
---------------------
The following code works okay if passed directly to the underlying table.
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("Absences"
If Not ErrorCondition Then
m_bFoundFile = True
Else
m_bFoundFile = False
End If
If m_bFoundFile Then
If rst.RecordCount > 0 Then
rst.MoveFirst
Do While Not rst.EOF
HoldDate = rst!Date
HoldDetail = rst!Details
Me.ctCalendar1.DateText(HoldDate) = HoldDetail
Me.ctCalendar1.DateImage(HoldDate) = rst!Image
rst.MoveNext
Loop
End If
End If
Exit Sub
DBErrorHandler:
'MsgBox " Database not Found!"
ErrorCondition = True
End Sub
---------------------
Could someone please advise what I have missed.
---------------------