Précédent   Forum des professionnels en informatique > Logiciels > Microsoft Office > Access > IHM
IHM Ce forum est dédié aux questions relatives à la création de formulaires et d'états, avec ou sans code VBA, et macros.
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 18/05/2011, 09h27   #1
Invité de passage
 
Homme Guillaume Pincemy
Chargé d'études environnement
Inscription : mai 2011
Messages : 11
Détails du profil
Informations personnelles :
Nom : Homme Guillaume Pincemy
Localisation : France, Pyrénées Atlantiques (Aquitaine)

Informations professionnelles :
Activité : Chargé d'études environnement
Secteur : Conseil

Informations forums :
Inscription : mai 2011
Messages : 11
Points : 1
Points : 1
Par défaut mise en forme conditionnelle sur champ date

Bonjour,

J'ai un petit problème. J'ai sur un formulaire de multiples champs appelant les dates de la façon suivante :
[Champ1]=date()
[Champ2]=date()+1
[Champ3]=date()+3

etc...

Et je voudrais que mon champ devienne grisé lorsque la date est un samedi ou un dimanche. J'ai entre autre essayé la mise en forme conditionnelle suivante :

JourSem([champ];2)>5

Mais ça ne fonctionne pas...

Quelqu'un aurait-il une idée ?
Kromai est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 18/05/2011, 10h22   #2
Membre Expert
 
Homme Jacques Petiot
Indépendant développeur et formateur
Inscription : octobre 2007
Messages : 891
Détails du profil
Informations personnelles :
Nom : Homme Jacques Petiot
Âge : 51
Localisation : France

Informations professionnelles :
Activité : Indépendant développeur et formateur
Secteur : Conseil

Informations forums :
Inscription : octobre 2007
Messages : 891
Points : 1 333
Points : 1 333
Hello
chez moi ça marche avec:
JourSem([champ1];2)>5
JourSem([champ2];2)>5
JourSem([champ3];2)>5
__________________
-------------------Simplifi----------comme si tout était simple--------
Simplifi est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 18/05/2011, 10h26   #3
Invité de passage
 
Homme Guillaume Pincemy
Chargé d'études environnement
Inscription : mai 2011
Messages : 11
Détails du profil
Informations personnelles :
Nom : Homme Guillaume Pincemy
Localisation : France, Pyrénées Atlantiques (Aquitaine)

Informations professionnelles :
Activité : Chargé d'études environnement
Secteur : Conseil

Informations forums :
Inscription : mai 2011
Messages : 11
Points : 1
Points : 1
Salut !
Ok, tu mets ça dans la mise en forme conditionnelle sur chaque champ ? et tes champs affichent la date par la même formule que moi : Date() ?
Kromai est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 18/05/2011, 11h16   #4
Membre Expert
 
Homme Jacques Petiot
Indépendant développeur et formateur
Inscription : octobre 2007
Messages : 891
Détails du profil
Informations personnelles :
Nom : Homme Jacques Petiot
Âge : 51
Localisation : France

Informations professionnelles :
Activité : Indépendant développeur et formateur
Secteur : Conseil

Informations forums :
Inscription : octobre 2007
Messages : 891
Points : 1 333
Points : 1 333
Hello
oui la mise en forme conditionnelle est à préciser sur chaque champ
bon, chez moi, la valeur a été fixée par du VB
__________________
-------------------Simplifi----------comme si tout était simple--------
Simplifi est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 18/05/2011, 11h20   #5
Invité de passage
 
Homme Guillaume Pincemy
Chargé d'études environnement
Inscription : mai 2011
Messages : 11
Détails du profil
Informations personnelles :
Nom : Homme Guillaume Pincemy
Localisation : France, Pyrénées Atlantiques (Aquitaine)

Informations professionnelles :
Activité : Chargé d'études environnement
Secteur : Conseil

Informations forums :
Inscription : mai 2011
Messages : 11
Points : 1
Points : 1
Ok je vois. Tu crois qu'il serait possible que tu me dises comment tu as codé ta valeur ? Si ce n'est pas trop long biensur
Kromai est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 18/05/2011, 11h34   #6
Membre Expert
 
Homme Jacques Petiot
Indépendant développeur et formateur
Inscription : octobre 2007
Messages : 891
Détails du profil
Informations personnelles :
Nom : Homme Jacques Petiot
Âge : 51
Localisation : France

Informations professionnelles :
Activité : Indépendant développeur et formateur
Secteur : Conseil

Informations forums :
Inscription : octobre 2007
Messages : 891
Points : 1 333
Points : 1 333
Hello
c'est très simple, dans toute ma base, j'ai souvent besoin de deux dates pour borner les requêtes, alors j'ai dans mon formulaire démarrage deux zones Début et Fin et comme je suis un gros fénéant, j'ai mis quelques boutons
Avec ces lignes de prog
Code :
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
Private Sub A_moins_Click()
Fin = Début - 0.0001
Début = Int(Fin - 360) - Format(Fin - 360, "y") + 1
End Sub
 
Private Sub A_plus_Click()
Début = Int(Fin + 0.5)
Fin = Int(Début + 370) - Format(Début + 370, "y") + 1 - 0.0001
End Sub
 
Private Sub Année_Click()
Début = Int(Now()) - Format(Now(), "y") + 1
Fin = Int(Début + 370) - Format(Début + 370, "y") + 1 - 0.0001
Cache_Bouton "A"
End Sub
 
Private Sub Début_Exit(Cancel As Integer)
If J_plus.Enabled Then
    Début = Int(Début)
    Fin = Début + 0.9999
End If
If S_plus.Enabled Then
    Début = Int(Début) - Format(Début, "w") + 1
    Fin = Début + 6.9999
End If
If M_plus.Enabled Then
    Début = Int(Début) - Format(Début, "dd") + 1
    Fin = Int(Début + 32) - Format(Début + 32, "dd") + 1 - 0.0001
End If
If T_plus.Enabled Then
    Début = CDate("01/" & 1 + 3 * (Format(Début, "q") - 1) & "/" & Year(Début))
    Fin = Int(Début + 92) - Format(Début + 92, "dd") + 0.9999
End If
If A_plus.Enabled Then Fin = Début + 366 - 0.0001
End Sub
 
Private Sub J_moins_Click()
Début = Début - 1
Fin = Fin - 1
End Sub
 
Private Sub J_plus_Click()
Début = Début + 1
Fin = Fin + 1
End Sub
 
Private Sub Jour_Click()
Début = Int(Now())
Fin = Int(Now() + 1) - 0.001
Cache_Bouton "J"
End Sub
 
Private Sub M_moins_Click()
Fin = Début - 0.0001
Début = Int(Début - 25) - Format(Début - 25, "dd") + 1
End Sub
 
Private Sub M_plus_Click()
Début = Int(Fin + 0.5)
Fin = Int(Début + 32) - Format(Début + 32, "dd") + 0.9999
End Sub
 
Private Sub Mois_Click()
Début = Int(Now()) - Format(Now(), "dd") + 1
Fin = Int(Début + 32) - Format(Début + 32, "dd") + 1 - 0.0001
Cache_Bouton "M"
End Sub
 
Private Sub S_moins_Click()
Début = Début - 7
Fin = Fin - 7
End Sub
 
Private Sub S_plus_Click()
Début = Début + 7
Fin = Fin + 7
End Sub
 
Private Sub Semaine_Click()
Début = Int(Now()) - Format(Now(), "w", vbMonday) + 1
Fin = Début + 6.9999
Cache_Bouton "S"
End Sub
 
Private Sub T_moins_Click()
Fin = Début - 0.0001
Début = Int(Début - 80) - Format(Début - 80, "dd") + 1
End Sub
 
Private Sub T_plus_Click()
Début = Int(Fin + 0.5)
Fin = Int(Début + 92) - Format(Début + 92, "dd") + 0.9999
End Sub
 
Private Sub Trimestre_Click()
Début = CDate("01/" & 1 + 3 * (Format(Now(), "q") - 1) & "/" & Year(Now()))
Fin = Int(Début + 92) - Format(Début + 92, "dd") + 0.9999
Cache_Bouton "T"
End Sub
 
Function Cache_Bouton(txt As String)
J_moins.Enabled = False
J_plus.Enabled = False
S_moins.Enabled = False
S_plus.Enabled = False
M_moins.Enabled = False
M_plus.Enabled = False
T_moins.Enabled = False
T_plus.Enabled = False
A_moins.Enabled = False
A_plus.Enabled = False
Me(txt & "_moins").Enabled = True
Me(txt & "_plus").Enabled = True
End Function
Images attachées
Type de fichier : png Menu.PNG (5,6 Ko, 3 affichages)
__________________
-------------------Simplifi----------comme si tout était simple--------
Simplifi est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 18/05/2011, 18h10   #7
Invité de passage
 
Homme Guillaume Pincemy
Chargé d'études environnement
Inscription : mai 2011
Messages : 11
Détails du profil
Informations personnelles :
Nom : Homme Guillaume Pincemy
Localisation : France, Pyrénées Atlantiques (Aquitaine)

Informations professionnelles :
Activité : Chargé d'études environnement
Secteur : Conseil

Informations forums :
Inscription : mai 2011
Messages : 11
Points : 1
Points : 1
A ouai en effet !
C'est assez différent de ce que j'ai fait j'ai beaucoup moins de code :p

Finalement je m'en suis sorti, la mise en forme conditionnelle ne fonctionnait pas je ne sais pour quelle raison, j'ai du juste annuler ce que j'avais tenté de mettre auparavant comme condition, et la remettre ensuite.

Merci de tes réponse ! bonne soirée !

Guillaume
Kromai est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 14h27.


 
 
 
 
Partenaires

Hébergement Web