Private Sub OptionsSet()
Dim strSQLlbx As String
Dim strWhere As String
Dim strWherechk As String
If Me.chkBusiness = True Then
strWherechk = strWherechk & ",'Business'"
End If
If Me.chkHolidays = True Then
strWherechk = strWherechk & ",'Holiday'"
End If
If Me.chkOther = True Then
strWherechk = strWherechk & ",'Other'"
End If
If Me.chkPersonal = True Then
strWherechk = strWherechk & ",'Personal'"
End If
If Left(strWherechk, 1) = "," Then
strWherechk = Right(strWherechk, Len(strWherechk) - 1)
strWherechk = "AND Categories Not In (" & strWherechk
strWherechk = strWherechk & ")"
Else
strWherechk = vbNullString
End If
strWhere = " WHERE ((tblAppointments.ApptDate)" & _
" >= [Forms]![frmDBApptDialog]![txtStartDate])" & _
" AND ((tblAppointments.EndDate)" & _
"<=[Forms]![frmDBApptDialog]![txtEndDate])"
strWhere = strWhere & strWherechk
strSQLlbx = "SELECT tblAppointments.ApptmntID," & _
" tblAppointments.Appt, tblAppointments.ApptDate," & _
" tblAppointments.EndDate, tblAppointments.Categories" & _
" FROM tblAppointments" & _
strWhere & _
" ORDER BY tblAppointments.ApptDate DESC;"
Me.lstAppointments.RowSource = strSQLlbx
Me.lstAppointments.Requery
End Sub
Private Sub tglSelectAll_AfterUpdate()
Dim i As Integer
If Me.tglSelectAll = True Then
For i = 1 To lstAppointments.ListCount
lstAppointments.Selected(i) = True
Next i
Me.tglSelectAll.Caption = "Deselect All"
Else
For i = 1 To lstAppointments.ListCount
lstAppointments.Selected(i) = False
Next i
Me.tglSelectAll.Caption = "Select All"
End If
End Sub
Private Sub chkBusiness_AfterUpdate()
If Len(Me.txtDateSelection & vbNullString) > 0 Then
OptionsSet
End If
End Sub
Private Sub chkHolidays_AfterUpdate()
If Len(Me.txtDateSelection & vbNullString) > 0 Then
OptionsSet
End If
End Sub
Private Sub chkOther_AfterUpdate()
If Len(Me.txtDateSelection & vbNullString) > 0 Then
OptionsSet
End If
End Sub
Private Sub chkPersonal_AfterUpdate()
If Len(Me.txtDateSelection & vbNullString) > 0 Then
OptionsSet
End If
End Sub