Ouvrir états en foncion de valeurs, Access
Résolu
maxireussite
Messages postés
405
Statut
Membre
-
maxireussite Messages postés 405 Statut Membre -
maxireussite Messages postés 405 Statut Membre -
Bonjour,
Je souhaite dans Access 2003 pouvoir ouvrir 3 états différents en fonction de la valeur d'un champs.
Quelqu'un pourrait-il m'indiquer la procédure ?
Merci de votre aide.
Je souhaite dans Access 2003 pouvoir ouvrir 3 états différents en fonction de la valeur d'un champs.
Quelqu'un pourrait-il m'indiquer la procédure ?
Merci de votre aide.
A voir également:
- Ouvrir états en foncion de valeurs, Access
- Comment ouvrir un fichier epub ? - Guide
- Comment ouvrir un fichier bin ? - Guide
- Ouvrir fichier .dat - Guide
- Comment ouvrir un fichier 7z - Guide
- Comment ouvrir un fichier docx ? - Guide
8 réponses
Bonjour,
Principe:
If Valeur_Champ = x Then
Nom_Rapport = "A"
ElseIf Valeur_Champ = y Then
Nom_Rapport = "B"
ElseIf Valeur_Champ = z Then
Nom_Rapport = "C"
Else
End If
DoCmd.OpenReport Nom_Rapport, acViewNormal
Bonne suite
Principe:
If Valeur_Champ = x Then
Nom_Rapport = "A"
ElseIf Valeur_Champ = y Then
Nom_Rapport = "B"
ElseIf Valeur_Champ = z Then
Nom_Rapport = "C"
Else
End If
DoCmd.OpenReport Nom_Rapport, acViewNormal
Bonne suite
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
Dans l'exemple ci-dessus, le bouton ouvre l'état et affiche 1 un enregistrement bien précis.
Private Sub AperçuFacture_Click()
On Error GoTo Err_AperçuFacture_Click
If Forms![Commandes par client]![Sous-formulaire Commandes par client].Form.RecordsetClone.RecordCount = 0 Then
MsgBox "Tapez les informations sur la commande avant d'afficher l'aperçu de la facture."
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenReport "Facture", acPreview, , "[RéfCommande] = Forms![Commandes par client]![Sous-formulaire Commandes par client].form![RéfCommande]"
End If
Exit_AperçuFacture_Click:
Exit Sub
Err_AperçuFacture_Click:
If Err <> 2501 Then
MsgBox Err.Description
End If
Resum
Comment filtrer comme dans l'exemple ci-dessus un enregistrement, dans cet exemple qui ouvre selon une valeur l'état 1,2 ou 3 ?
Comment « combiner les deux ? Est-ce possible ?
Private Sub Commande64_Click()
Select Case Forms![Commandes par client]![Sous-formulaire Commandes par client].Form![TypeInterventions]
Case "3d"
DoCmd.OpenReport "Interventions", acPreview
Case "Anti-termites"
DoCmd.OpenReport "Intervention2", acPreview
Case "Barrière Physico-chimique"
DoCmd.OpenReport "Intervention3", acPreview
End Select
End Sub
Private Sub AperçuFacture_Click()
On Error GoTo Err_AperçuFacture_Click
If Forms![Commandes par client]![Sous-formulaire Commandes par client].Form.RecordsetClone.RecordCount = 0 Then
MsgBox "Tapez les informations sur la commande avant d'afficher l'aperçu de la facture."
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenReport "Facture", acPreview, , "[RéfCommande] = Forms![Commandes par client]![Sous-formulaire Commandes par client].form![RéfCommande]"
End If
Exit_AperçuFacture_Click:
Exit Sub
Err_AperçuFacture_Click:
If Err <> 2501 Then
MsgBox Err.Description
End If
Resum
Comment filtrer comme dans l'exemple ci-dessus un enregistrement, dans cet exemple qui ouvre selon une valeur l'état 1,2 ou 3 ?
Comment « combiner les deux ? Est-ce possible ?
Private Sub Commande64_Click()
Select Case Forms![Commandes par client]![Sous-formulaire Commandes par client].Form![TypeInterventions]
Case "3d"
DoCmd.OpenReport "Interventions", acPreview
Case "Anti-termites"
DoCmd.OpenReport "Intervention2", acPreview
Case "Barrière Physico-chimique"
DoCmd.OpenReport "Intervention3", acPreview
End Select
End Sub
Bon, ben j'y suis arrivé, voilà la solution :
Private Sub Commande64_Click()
Select Case Forms![Commandes par client]![Sous-formulaire Commandes par client].Form![TypeInterventions]
Case "3d"
DoCmd.OpenReport "Interventions", acPreview, , "[RefIntervention] = Forms![Commandes par client]![Sous-formulaire Commandes par client].form![RefIntervention]"
Case "Anti-termites"
DoCmd.OpenReport "Intervention2", acPreview, , "[RefIntervention] = Forms![Commandes par client]![Sous-formulaire Commandes par client].form![RefIntervention]"
Case "Barrière Physico-chimique"
DoCmd.OpenReport "Intervention3", acPreview, , "[RefIntervention] = Forms![Commandes par client]![Sous-formulaire Commandes par client].form![RefIntervention]"
End Select
End Sub
Private Sub Commande64_Click()
Select Case Forms![Commandes par client]![Sous-formulaire Commandes par client].Form![TypeInterventions]
Case "3d"
DoCmd.OpenReport "Interventions", acPreview, , "[RefIntervention] = Forms![Commandes par client]![Sous-formulaire Commandes par client].form![RefIntervention]"
Case "Anti-termites"
DoCmd.OpenReport "Intervention2", acPreview, , "[RefIntervention] = Forms![Commandes par client]![Sous-formulaire Commandes par client].form![RefIntervention]"
Case "Barrière Physico-chimique"
DoCmd.OpenReport "Intervention3", acPreview, , "[RefIntervention] = Forms![Commandes par client]![Sous-formulaire Commandes par client].form![RefIntervention]"
End Select
End Sub