Bonjour,
Je développe une base de données sur Access 2013 pour la gestion des présences et Absences des personnels d’une petite Entreprise de Perpignan.
Cette Entreprise est fermée entre Noël et le jour de l’an. Le solde des congés étant pris dans le courant de l’Eté est géré par table, requête, formulaire et Etats.
Pour simplifier la saisie de cette période de Fermeture , j’ai adapté un code trouvé sur le net qui en une seule saisie me valide les congés pour cette période par des colonnes colorées les jours concernés (Mise en forme conditionnelle).
Néanmoins je souhaiterais ajouter à chacune de ces cellules (Nom_Salarié/Jour de Fermeture) la lettre « C » comme congés mais je ne sais comment m’y prendre. Avez-vous des suggestions ou exemples.
D’avance merci
Le code est le suivant :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 Public Function EstConge(Jour As Date) As Boolean EstConge = Not IsNull(DLookup("DateD", "T_Conges", "DateD<=" & FDateUs(Jour) & " and DateF>=" & FDateUs(Jour))) End Function
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 Public Function FDateUs(vDate As Date) As String FDateUs = "#" & Format(vDate, "mm/dd/yyyy") & "#" End Function
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 Public Sub MajPlanning() Dim ND As Integer, j As Integer Dim DateJ As Date ND = DaysInMonth(Forms!F_Planning!Mois, Forms!F_Planning!An) DateJ = DateSerial(Forms!F_Planning!An, Forms!F_Planning!Mois, 1) Forms!F_Planning!SF_Planning.Form!Jour1.SetFocus For j = 1 To ND Forms!F_Planning!SF_Planning.Form("Col" & j).Caption = UCase(Left(Format(DateJ, "ddd"), 1)) & vbCrLf & j If (DateJ = Date) Then Forms!F_Planning!SF_Planning.Form("Col" & j).BackColor = 15852772 Forms!F_Planning!SF_Planning.Form("Jour" & j).BackColor = 15852772 Else If EstWeekEnd(DateJ) Or EstFerie(DateJ) Then Forms!F_Planning!SF_Planning.Form("Col" & j).BackColor = 13428479 Forms!F_Planning!SF_Planning.Form("Jour" & j).BackColor = 13428479 Else If EstConge(DateJ) Then Forms!F_Planning!SF_Planning.Form("Col" & j).BackColor = 13428479 Forms!F_Planning!SF_Planning.Form("Jour" & j).BackColor = 5617050 Else Forms!F_Planning!SF_Planning.Form("Col" & j).BackColor = 16761024 Forms!F_Planning!SF_Planning.Form("Jour" & j).BackColor = vbWhite End If DateJ = DateJ + 1 Next j For j = 29 To ND Forms!F_Planning!SF_Planning.Form("Col" & j).Visible = True Forms!F_Planning!SF_Planning.Form("Jour" & j).Visible = True Next j For j = (ND + 1) To 31 Forms!F_Planning!SF_Planning.Form("Col" & j).Visible = False Forms!F_Planning!SF_Planning.Form("Jour" & j).Visible = False Next j Forms!F_Planning!SF_Planning.Requery End Sub
Partager