IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Modélisation Discussion :

Données n'apparaissent pas dans le formulaire anglais pour une mise à jour, oui pour le formulaire francais


Sujet :

Modélisation

  1. #1
    Membre à l'essai
    Homme Profil pro
    Technicien réseau
    Inscrit en
    Septembre 2017
    Messages
    52
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 59
    Localisation : Canada

    Informations professionnelles :
    Activité : Technicien réseau
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Septembre 2017
    Messages : 52
    Points : 15
    Points
    15
    Par défaut Données n'apparaissent pas dans le formulaire anglais pour une mise à jour, oui pour le formulaire francais
    Bonjour,

    Je suis vraiment débutant.

    Je travail sur une base de données qui gère nos commandes de fabrication pour des agendas scolaire.

    J'ai un formulaire détailProduct scolaire et un détailProduit scolaire_E. Un ouvre avec les détails de la commande et l'autre n'as plus de détails


    Lorsque je sélectionne un produit dans le formulaire de commande et active le bouton modifier ce produit, un autre formulaire apparais (detail Produit) avec les détails du produit. Le formulaire français est correct mais pas l'anglais.
    Images attachées Images attachées    

  2. #2
    Expert éminent sénior
    Avatar de tee_grandbois
    Homme Profil pro
    retraité
    Inscrit en
    Novembre 2004
    Messages
    8 648
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 67
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : retraité

    Informations forums :
    Inscription : Novembre 2004
    Messages : 8 648
    Points : 14 626
    Points
    14 626
    Par défaut
    bonsoir,
    est-ce que le produit est sélectionné par son identifiant ou par son libellé ? Si c'est par son libellé, y a t-il une traduction pour l'anglais ?
    Si c'est le cas, il vaut mieux utiliser l'identifiant plutôt que le libellé et le faire aussi ici : https://www.developpez.net/forums/d1...volution-code/
    Quand on est derrière l'écran on n'a aucun clavier sous les mains ...
    ah non ? donc devant l'écran c'est la connectique ?

  3. #3
    Membre à l'essai
    Homme Profil pro
    Technicien réseau
    Inscrit en
    Septembre 2017
    Messages
    52
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 59
    Localisation : Canada

    Informations professionnelles :
    Activité : Technicien réseau
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Septembre 2017
    Messages : 52
    Points : 15
    Points
    15
    Par défaut
    Citation Envoyé par tee_grandbois Voir le message
    bonsoir,
    est-ce que le produit est sélectionné par son identifiant ou par son libellé ? Si c'est par son libellé, y a t-il une traduction pour l'anglais ?
    Si c'est le cas, il vaut mieux utiliser l'identifiant plutôt que le libellé et le faire aussi ici : https://www.developpez.net/forums/d1...volution-code/
    Bon matin,

    J'essai de comparer entre les deux formulaires qu'est ce qui a de différent et je trouve pas.

    Voici le message erreur lorsque je tente de quitter le formulaire de detailproduit anglais.

    Lorsque le produit est sélectionné dans le formulaire commande et que on active le bouton "Modify selected item" le formulaire detail produit apparait mais il y a pas les detail de l'item sélectionné.

    Voici le formulaire français avec les données qui devrais être affiché dans le formulaire anglais.
    Images attachées Images attachées    

  4. #4
    Expert éminent sénior
    Avatar de tee_grandbois
    Homme Profil pro
    retraité
    Inscrit en
    Novembre 2004
    Messages
    8 648
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 67
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : retraité

    Informations forums :
    Inscription : Novembre 2004
    Messages : 8 648
    Points : 14 626
    Points
    14 626
    Par défaut
    bonjour,
    cela ne sert à rien de poster les écrans si on ne voit pas le code qu'il y a derrière. Est-ce du code VBA qu'il y a sur le clic du bouton ou est-ce une macro ? Si c'est du VBA il faudrait le copier et le coller dans le message entre les balises de code générées par l'icône #
    Quand on est derrière l'écran on n'a aucun clavier sous les mains ...
    ah non ? donc devant l'écran c'est la connectique ?

  5. #5
    Membre à l'essai
    Homme Profil pro
    Technicien réseau
    Inscrit en
    Septembre 2017
    Messages
    52
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 59
    Localisation : Canada

    Informations professionnelles :
    Activité : Technicien réseau
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Septembre 2017
    Messages : 52
    Points : 15
    Points
    15
    Par défaut
    Citation Envoyé par tee_grandbois Voir le message
    bonjour,
    cela ne sert à rien de poster les écrans si on ne voit pas le code qu'il y a derrière. Est-ce du code VBA qu'il y a sur le clic du bouton ou est-ce une macro ? Si c'est du VBA il faudrait le copier et le coller dans le message entre les balises de code générées par l'icône #
    Sur clic du bouton "Modify selected item" il y a Procédure évenementielle si je clic sur le carré avec trois petit point ç m'apporte a ce code.

    Private Sub cmd_ModifProduit_Click()
    Dim ProduitSelect As Long


    If Me.lst_ProduitClient.ItemsSelected.count > 0 Then

    ProduitSelect = Me.lst_ProduitClient.Column(0, Me.lst_ProduitClient.ItemsSelected)

    If Me.lst_ProduitClient.Column(8, Me.lst_ProduitClient.ItemsSelected) = 40 Then
    DoCmd.OpenForm "frm_DetailProduit_Scolaire_E", , , , , acWindowNormal, ProduitSelect
    ElseIf Me.lst_ProduitClient.Column(8, Me.lst_ProduitClient.ItemsSelected) = 45 Then
    DoCmd.OpenForm "frm_DetailProduit_Academique_E", , , , , acWindowNormal, ProduitSelect
    End If
    Me.Visible = False
    Else
    MsgBox "No item selected", vbCritical, "No item selected"
    End If

    End Sub

  6. #6
    Membre à l'essai
    Homme Profil pro
    Technicien réseau
    Inscrit en
    Septembre 2017
    Messages
    52
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 59
    Localisation : Canada

    Informations professionnelles :
    Activité : Technicien réseau
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Septembre 2017
    Messages : 52
    Points : 15
    Points
    15
    Par défaut
    Citation Envoyé par tee_grandbois Voir le message
    bonsoir,
    est-ce que le produit est sélectionné par son identifiant ou par son libellé ? Si c'est par son libellé, y a t-il une traduction pour l'anglais ?
    Si c'est le cas, il vaut mieux utiliser l'identifiant plutôt que le libellé et le faire aussi ici : https://www.developpez.net/forums/d1...volution-code/
    Est ce que tu veux dire, la couleur est choisi par son nom pour par le id de la couleur genre
    Images attachées Images attachées  

  7. #7
    Expert éminent sénior
    Avatar de tee_grandbois
    Homme Profil pro
    retraité
    Inscrit en
    Novembre 2004
    Messages
    8 648
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 67
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : retraité

    Informations forums :
    Inscription : Novembre 2004
    Messages : 8 648
    Points : 14 626
    Points
    14 626
    Par défaut
    Est ce que tu veux dire, la couleur est choisi par son nom pour par le id de la couleur genre
    après décryptage de ton post, je dirai oui d'autant plus que tu as une colonne libellé pour chaque langue.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
      If Me.lst_CouleurReliure.Column(0) = n Then ...
    n correspond à l'identifiant pour À confirmer

    Pour ce post-ci, je ne vois pas ce qui ne lui plait pas, je ne vois pas de Else en trop ...
    Quand on est derrière l'écran on n'a aucun clavier sous les mains ...
    ah non ? donc devant l'écran c'est la connectique ?

  8. #8
    Membre à l'essai
    Homme Profil pro
    Technicien réseau
    Inscrit en
    Septembre 2017
    Messages
    52
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 59
    Localisation : Canada

    Informations professionnelles :
    Activité : Technicien réseau
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Septembre 2017
    Messages : 52
    Points : 15
    Points
    15
    Par défaut
    Citation Envoyé par tee_grandbois Voir le message
    après décryptage de ton post, je dirai oui d'autant plus que tu as une colonne libellé pour chaque langue.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
      If Me.lst_CouleurReliure.Column(0) = n Then ...
    n correspond à l'identifiant pour À confirmer

    Pour ce post-ci, je ne vois pas ce qui ne lui plait pas, je ne vois pas de Else en trop ...
    Salut j'ai trouvé pourquoi les données dans le formulaire anglais n'apparaissais pas. Le code relié au formulaire anglais étais pas identique au français.

    Bon maintenant j'ai un problème de de else sans if dans le code suivant et le débogeur m'indique le Else juste au dessus de la phrase suivante: MsgBox "Certaine(s) date(s) nécessaire à la création de la fiche de production sont manquantes!", vbCritical, "Date manquante"
    End If


    Private Sub cmd_FicheProd_Click()

    If Me.lst_CouleurReliure.Column(1) = "35" Then
    MsgBox "Couleur de la spirale invalide, Vous devez entré une couleur valide.", vbExclamation
    Exit Sub
    End If
    Dim sqlString, DateTerminaisonCalc As String
    Dim rs, rs2, rs3 As Recordset

    sqlString = "SELECT tbl_Commande.DateSignature, tbl_Tache.DateFinReel, tbl_Commande_Produit.ProduitID, tbl_Tache.TypeTacheID, tbl_Tache.MachineID, tbl_Commande.ID_Commande " & _
    "FROM (tbl_Commande_Produit INNER JOIN tbl_Tache ON tbl_Commande_Produit.ID_CommandeProduit = tbl_Tache.ID_CommandeProduit) INNER JOIN tbl_Commande ON tbl_Commande_Produit.CommandeID = tbl_Commande.ID_Commande " & _
    "WHERE (((tbl_Commande.DateSignature) Is Null) AND ((tbl_Commande_Produit.ProduitID)=" & NoProduit & ") AND ((tbl_Tache.TypeTacheID)=19) AND ((tbl_Tache.MachineID)=34)) OR (((tbl_Tache.DateFinReel) Is Null) AND ((tbl_Commande_Produit.ProduitID)=" & NoProduit & ") AND ((tbl_Tache.TypeTacheID)=19) AND ((tbl_Tache.MachineID)=34));"
    Set rs = CurrentDb.OpenRecordset(sqlString, dbOpenDynaset, dbSeeChanges)

    If rs.RecordCount = 0 Then
    sqlString = "SELECT tbl_Commande.DateExpedition, tbl_Commande_Produit.ProduitID, tbl_Commande.DateTerminaison " & _
    "FROM tbl_Commande_Produit INNER JOIN tbl_Commande ON tbl_Commande_Produit.CommandeID = tbl_Commande.ID_Commande " & _
    "WHERE (((tbl_Commande_Produit.ProduitID)=" & NoProduit & "));"
    Set rs2 = CurrentDb.OpenRecordset(sqlString, dbOpenDynaset, dbSeeChanges)

    If rs2.RecordCount > 0 Then
    If Nz(rs2.Fields("[DateExpedition]"), 0) <> 0 Then
    If Nz(rs2.Fields("[DateTerminaison]"), 0) = 0 Then
    tempDate1 = CalcDateTerminaison(NoProduit)
    If tempDate1 = 0 Then
    tempDate2 = "0"
    Else
    tempDate2 = "#" & Month(tempDate1) & "-" & Day(tempDate1) & "-" & Year(tempDate1) & "#"
    End If
    sqlString = "UPDATE tbl_Commande_Produit INNER JOIN tbl_Commande ON tbl_Commande_Produit.CommandeID = tbl_Commande.ID_Commande SET tbl_Commande.DateTerminaison = " & tempDate2 & " " & _
    "WHERE (((tbl_Commande_Produit.ProduitID)=" & NoProduit & "));"
    CurrentDb.Execute sqlString, dbFailOnError
    End If
    sqlString = "UPDATE tbl_Produit SET tbl_Produit.ImpressionFicheProd = 1 " & _
    "WHERE (((tbl_Produit.ID_Produit)=" & NoProduit & "));"
    CurrentDb.Execute sqlString, dbFailOnError

    DoCmd.OpenReport "rpt_FicheProductionAupel", acViewPreview, , "[tbl_Produit].[ID_Produit]=" & NoProduit, , "Produit"
    DoCmd.RunCommand (acCmdZoom100)
    Else
    MsgBox "Il n'y a pas de date d'expédition!", vbCritical, "Date d'expédition"
    End If
    Else
    MsgBox "Couleur spirale manquante", vbCritical, "Couleur spirale"
    End If
    End If
    rs2.Close
    Else
    Private Sub cmd_FicheProd_Click()

    If Me.lst_CouleurReliure.Column(1) = "35" Then
    MsgBox "Couleur de la spirale invalide, Vous devez entré une couleur valide.", vbExclamation
    Exit Sub
    End If
    Dim sqlString, DateTerminaisonCalc As String
    Dim rs, rs2, rs3 As Recordset

    sqlString = "SELECT tbl_Commande.DateSignature, tbl_Tache.DateFinReel, tbl_Commande_Produit.ProduitID, tbl_Tache.TypeTacheID, tbl_Tache.MachineID, tbl_Commande.ID_Commande " & _
    "FROM (tbl_Commande_Produit INNER JOIN tbl_Tache ON tbl_Commande_Produit.ID_CommandeProduit = tbl_Tache.ID_CommandeProduit) INNER JOIN tbl_Commande ON tbl_Commande_Produit.CommandeID = tbl_Commande.ID_Commande " & _
    "WHERE (((tbl_Commande.DateSignature) Is Null) AND ((tbl_Commande_Produit.ProduitID)=" & NoProduit & ") AND ((tbl_Tache.TypeTacheID)=19) AND ((tbl_Tache.MachineID)=34)) OR (((tbl_Tache.DateFinReel) Is Null) AND ((tbl_Commande_Produit.ProduitID)=" & NoProduit & ") AND ((tbl_Tache.TypeTacheID)=19) AND ((tbl_Tache.MachineID)=34));"
    Set rs = CurrentDb.OpenRecordset(sqlString, dbOpenDynaset, dbSeeChanges)

    If rs.RecordCount = 0 Then
    sqlString = "SELECT tbl_Commande.DateExpedition, tbl_Commande_Produit.ProduitID, tbl_Commande.DateTerminaison " & _
    "FROM tbl_Commande_Produit INNER JOIN tbl_Commande ON tbl_Commande_Produit.CommandeID = tbl_Commande.ID_Commande " & _
    "WHERE (((tbl_Commande_Produit.ProduitID)=" & NoProduit & "));"
    Set rs2 = CurrentDb.OpenRecordset(sqlString, dbOpenDynaset, dbSeeChanges)

    If rs2.RecordCount > 0 Then
    If Nz(rs2.Fields("[DateExpedition]"), 0) <> 0 Then
    If Nz(rs2.Fields("[DateTerminaison]"), 0) = 0 Then
    tempDate1 = CalcDateTerminaison(NoProduit)
    If tempDate1 = 0 Then
    tempDate2 = "0"
    Else
    tempDate2 = "#" & Month(tempDate1) & "-" & Day(tempDate1) & "-" & Year(tempDate1) & "#"
    End If
    sqlString = "UPDATE tbl_Commande_Produit INNER JOIN tbl_Commande ON tbl_Commande_Produit.CommandeID = tbl_Commande.ID_Commande SET tbl_Commande.DateTerminaison = " & tempDate2 & " " & _
    "WHERE (((tbl_Commande_Produit.ProduitID)=" & NoProduit & "));"
    CurrentDb.Execute sqlString, dbFailOnError
    End If
    sqlString = "UPDATE tbl_Produit SET tbl_Produit.ImpressionFicheProd = 1 " & _
    "WHERE (((tbl_Produit.ID_Produit)=" & NoProduit & "));"
    CurrentDb.Execute sqlString, dbFailOnError

    DoCmd.OpenReport "rpt_FicheProductionAupel", acViewPreview, , "[tbl_Produit].[ID_Produit]=" & NoProduit, , "Produit"
    DoCmd.RunCommand (acCmdZoom100)
    Else
    MsgBox "Il n'y a pas de date d'expédition!", vbCritical, "Date d'expédition"
    End If
    Else
    MsgBox "Couleur spirale manquante", vbCritical, "Couleur spirale"
    End If
    End If
    rs2.Close
    Else
    MsgBox "Certaine(s) date(s) nécessaire à la création de la fiche de production sont manquantes!", vbCritical, "Date manquante"
    End If

    rs.Close


    End Sub
    End If

    rs.Close


    End Sub

  9. #9
    Expert éminent sénior
    Avatar de tee_grandbois
    Homme Profil pro
    retraité
    Inscrit en
    Novembre 2004
    Messages
    8 648
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 67
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : retraité

    Informations forums :
    Inscription : Novembre 2004
    Messages : 8 648
    Points : 14 626
    Points
    14 626
    Par défaut
    1) utilise les balises de code pour poster du code c'est l'icône #
    2) prend l'habitude d'indenter ton code ( mettre une tabulation pour chaque instruction If ou Case ou Do ...) comme ça tu vois tout de suite si il manque un End If ou si un Else est en trop.
    Exemple :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    If condition1 Then
        ' instructions condition1
        If condition2 Then
            'instructions conditions2
            If condition3 Then
                ' instructions condition3
            End If
        Else   ' condition2
           ' instructions else condition2
        End If
    End If
    3) des que tu as tapé une instruction If, Do ou While, mets tout de suite l'instruction End If, Loop ou Wend qui va avec, comme çà tu ne l'oublies pas tu peux ensuite implémenter ton code
    Pour ton code il y a peu-être d'autres erreurs mais le compilateur indique la première erreur trouvée : juste avant la fin, il y a un End Sub juste avant un End If ce qui explique (peut-être) ton erreur avec Else.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    MsgBox "Certaine(s) date(s) nécessaire à la création de la fiche de production sont manquantes!", vbCritical, "Date manquante"
    End If
    
    rs.Close
    
    
    End Sub
    End If
    
    rs.Close
    
    
    End Sub
    Le End Sub en rouge est en trop.
    Quand on est derrière l'écran on n'a aucun clavier sous les mains ...
    ah non ? donc devant l'écran c'est la connectique ?

  10. #10
    Membre à l'essai
    Homme Profil pro
    Technicien réseau
    Inscrit en
    Septembre 2017
    Messages
    52
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 59
    Localisation : Canada

    Informations professionnelles :
    Activité : Technicien réseau
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Septembre 2017
    Messages : 52
    Points : 15
    Points
    15
    Par défaut
    Citation Envoyé par tee_grandbois Voir le message
    1) utilise les balises de code pour poster du code c'est l'icône #
    2) prend l'habitude d'indenter ton code ( mettre une tabulation pour chaque instruction If ou Case ou Do ...) comme ça tu vois tout de suite si il manque un End If ou si un Else est en trop.
    Exemple :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    If condition1 Then
        ' instructions condition1
        If condition2 Then
            'instructions conditions2
            If condition3 Then
                ' instructions condition3
            End If
        Else   ' condition2
           ' instructions else condition2
        End If
    End If
    3) des que tu as tapé une instruction If, Do ou While, mets tout de suite l'instruction End If, Loop ou Wend qui va avec, comme çà tu ne l'oublies pas tu peux ensuite implémenter ton code
    Pour ton code il y a peu-être d'autres erreurs mais le compilateur indique la première erreur trouvée : juste avant la fin, il y a un End Sub juste avant un End If ce qui explique (peut-être) ton erreur avec Else.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    MsgBox "Certaine(s) date(s) nécessaire à la création de la fiche de production sont manquantes!", vbCritical, "Date manquante"
    End If
    
    rs.Close
    
    
    End Sub
    End If
    
    rs.Close
    
    
    End Sub
    Le End Sub en rouge est en trop.
    Donc si je comprend bien le End Sub et placé en avant de End If et ça devrais être le contraire?

  11. #11
    Membre à l'essai
    Homme Profil pro
    Technicien réseau
    Inscrit en
    Septembre 2017
    Messages
    52
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 59
    Localisation : Canada

    Informations professionnelles :
    Activité : Technicien réseau
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Septembre 2017
    Messages : 52
    Points : 15
    Points
    15
    Par défaut
    Citation Envoyé par Dano60 Voir le message
    Salut j'ai trouvé pourquoi les données dans le formulaire anglais n'apparaissais pas. Le code relié au formulaire anglais étais pas identique au français.

    Bon maintenant j'ai un problème de de else sans if dans le code suivant et le débogeur m'indique le Else juste au dessus de la phrase suivante: MsgBox "Certaine(s) date(s) nécessaire à la création de la fiche de production sont manquantes!", vbCritical, "Date manquante"
    End If


    Private Sub cmd_FicheProd_Click()

    If Me.lst_CouleurReliure.Column(1) = "35" Then
    MsgBox "Couleur de la spirale invalide, Vous devez entré une couleur valide.", vbExclamation
    Exit Sub
    End If
    Dim sqlString, DateTerminaisonCalc As String
    Dim rs, rs2, rs3 As Recordset

    sqlString = "SELECT tbl_Commande.DateSignature, tbl_Tache.DateFinReel, tbl_Commande_Produit.ProduitID, tbl_Tache.TypeTacheID, tbl_Tache.MachineID, tbl_Commande.ID_Commande " & _
    "FROM (tbl_Commande_Produit INNER JOIN tbl_Tache ON tbl_Commande_Produit.ID_CommandeProduit = tbl_Tache.ID_CommandeProduit) INNER JOIN tbl_Commande ON tbl_Commande_Produit.CommandeID = tbl_Commande.ID_Commande " & _
    "WHERE (((tbl_Commande.DateSignature) Is Null) AND ((tbl_Commande_Produit.ProduitID)=" & NoProduit & ") AND ((tbl_Tache.TypeTacheID)=19) AND ((tbl_Tache.MachineID)=34)) OR (((tbl_Tache.DateFinReel) Is Null) AND ((tbl_Commande_Produit.ProduitID)=" & NoProduit & ") AND ((tbl_Tache.TypeTacheID)=19) AND ((tbl_Tache.MachineID)=34));"
    Set rs = CurrentDb.OpenRecordset(sqlString, dbOpenDynaset, dbSeeChanges)

    If rs.RecordCount = 0 Then
    sqlString = "SELECT tbl_Commande.DateExpedition, tbl_Commande_Produit.ProduitID, tbl_Commande.DateTerminaison " & _
    "FROM tbl_Commande_Produit INNER JOIN tbl_Commande ON tbl_Commande_Produit.CommandeID = tbl_Commande.ID_Commande " & _
    "WHERE (((tbl_Commande_Produit.ProduitID)=" & NoProduit & "));"
    Set rs2 = CurrentDb.OpenRecordset(sqlString, dbOpenDynaset, dbSeeChanges)

    If rs2.RecordCount > 0 Then
    If Nz(rs2.Fields("[DateExpedition]"), 0) <> 0 Then
    If Nz(rs2.Fields("[DateTerminaison]"), 0) = 0 Then
    tempDate1 = CalcDateTerminaison(NoProduit)
    If tempDate1 = 0 Then
    tempDate2 = "0"
    Else
    tempDate2 = "#" & Month(tempDate1) & "-" & Day(tempDate1) & "-" & Year(tempDate1) & "#"
    End If
    sqlString = "UPDATE tbl_Commande_Produit INNER JOIN tbl_Commande ON tbl_Commande_Produit.CommandeID = tbl_Commande.ID_Commande SET tbl_Commande.DateTerminaison = " & tempDate2 & " " & _
    "WHERE (((tbl_Commande_Produit.ProduitID)=" & NoProduit & "));"
    CurrentDb.Execute sqlString, dbFailOnError
    End If
    sqlString = "UPDATE tbl_Produit SET tbl_Produit.ImpressionFicheProd = 1 " & _
    "WHERE (((tbl_Produit.ID_Produit)=" & NoProduit & "));"
    CurrentDb.Execute sqlString, dbFailOnError

    DoCmd.OpenReport "rpt_FicheProductionAupel", acViewPreview, , "[tbl_Produit].[ID_Produit]=" & NoProduit, , "Produit"
    DoCmd.RunCommand (acCmdZoom100)
    Else
    MsgBox "Il n'y a pas de date d'expédition!", vbCritical, "Date d'expédition"
    End If
    Else
    MsgBox "Couleur spirale manquante", vbCritical, "Couleur spirale"
    End If
    End If
    rs2.Close
    Else
    Private Sub cmd_FicheProd_Click()

    If Me.lst_CouleurReliure.Column(1) = "35" Then
    MsgBox "Couleur de la spirale invalide, Vous devez entré une couleur valide.", vbExclamation
    Exit Sub
    End If
    Dim sqlString, DateTerminaisonCalc As String
    Dim rs, rs2, rs3 As Recordset

    sqlString = "SELECT tbl_Commande.DateSignature, tbl_Tache.DateFinReel, tbl_Commande_Produit.ProduitID, tbl_Tache.TypeTacheID, tbl_Tache.MachineID, tbl_Commande.ID_Commande " & _
    "FROM (tbl_Commande_Produit INNER JOIN tbl_Tache ON tbl_Commande_Produit.ID_CommandeProduit = tbl_Tache.ID_CommandeProduit) INNER JOIN tbl_Commande ON tbl_Commande_Produit.CommandeID = tbl_Commande.ID_Commande " & _
    "WHERE (((tbl_Commande.DateSignature) Is Null) AND ((tbl_Commande_Produit.ProduitID)=" & NoProduit & ") AND ((tbl_Tache.TypeTacheID)=19) AND ((tbl_Tache.MachineID)=34)) OR (((tbl_Tache.DateFinReel) Is Null) AND ((tbl_Commande_Produit.ProduitID)=" & NoProduit & ") AND ((tbl_Tache.TypeTacheID)=19) AND ((tbl_Tache.MachineID)=34));"
    Set rs = CurrentDb.OpenRecordset(sqlString, dbOpenDynaset, dbSeeChanges)

    If rs.RecordCount = 0 Then
    sqlString = "SELECT tbl_Commande.DateExpedition, tbl_Commande_Produit.ProduitID, tbl_Commande.DateTerminaison " & _
    "FROM tbl_Commande_Produit INNER JOIN tbl_Commande ON tbl_Commande_Produit.CommandeID = tbl_Commande.ID_Commande " & _
    "WHERE (((tbl_Commande_Produit.ProduitID)=" & NoProduit & "));"
    Set rs2 = CurrentDb.OpenRecordset(sqlString, dbOpenDynaset, dbSeeChanges)

    If rs2.RecordCount > 0 Then
    If Nz(rs2.Fields("[DateExpedition]"), 0) <> 0 Then
    If Nz(rs2.Fields("[DateTerminaison]"), 0) = 0 Then
    tempDate1 = CalcDateTerminaison(NoProduit)
    If tempDate1 = 0 Then
    tempDate2 = "0"
    Else
    tempDate2 = "#" & Month(tempDate1) & "-" & Day(tempDate1) & "-" & Year(tempDate1) & "#"
    End If
    sqlString = "UPDATE tbl_Commande_Produit INNER JOIN tbl_Commande ON tbl_Commande_Produit.CommandeID = tbl_Commande.ID_Commande SET tbl_Commande.DateTerminaison = " & tempDate2 & " " & _
    "WHERE (((tbl_Commande_Produit.ProduitID)=" & NoProduit & "));"
    CurrentDb.Execute sqlString, dbFailOnError
    End If
    sqlString = "UPDATE tbl_Produit SET tbl_Produit.ImpressionFicheProd = 1 " & _
    "WHERE (((tbl_Produit.ID_Produit)=" & NoProduit & "));"
    CurrentDb.Execute sqlString, dbFailOnError

    DoCmd.OpenReport "rpt_FicheProductionAupel", acViewPreview, , "[tbl_Produit].[ID_Produit]=" & NoProduit, , "Produit"
    DoCmd.RunCommand (acCmdZoom100)
    Else
    MsgBox "Il n'y a pas de date d'expédition!", vbCritical, "Date d'expédition"
    End If
    Else
    MsgBox "Couleur spirale manquante", vbCritical, "Couleur spirale"
    End If
    End If
    rs2.Close
    Else
    MsgBox "Certaine(s) date(s) nécessaire à la création de la fiche de production sont manquantes!", vbCritical, "Date manquante"
    End If

    rs.Close


    End Sub
    End If

    rs.Close


    End Sub
    Il y a eu une erreur, je sais pas ce qui s'est passé!!!!!

    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
    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
    Private Sub cmd_FicheProd_Click()
     
    If Me.lst_CouleurReliure.Column(1) = "35" Then
          MsgBox "Couleur de la spirale invalide, Vous devez entré une couleur valide.", vbExclamation
          Exit Sub
      End If
    Dim sqlString, DateTerminaisonCalc As String
    Dim rs, rs2, rs3 As Recordset
     
     
    sqlString = "SELECT tbl_Commande.DateSignature, tbl_Tache.DateFinReel, tbl_Commande_Produit.ProduitID, tbl_Tache.TypeTacheID, tbl_Tache.MachineID, tbl_Commande.ID_Commande " & _
                    "FROM (tbl_Commande_Produit INNER JOIN tbl_Tache ON tbl_Commande_Produit.ID_CommandeProduit = tbl_Tache.ID_CommandeProduit) INNER JOIN tbl_Commande ON tbl_Commande_Produit.CommandeID = tbl_Commande.ID_Commande " & _
                    "WHERE (((tbl_Commande.DateSignature) Is Null) AND ((tbl_Commande_Produit.ProduitID)=" & NoProduit & ") AND ((tbl_Tache.TypeTacheID)=19) AND ((tbl_Tache.MachineID)=34)) OR (((tbl_Tache.DateFinReel) Is Null) AND ((tbl_Commande_Produit.ProduitID)=" & NoProduit & ") AND ((tbl_Tache.TypeTacheID)=19) AND ((tbl_Tache.MachineID)=34));"
    Set rs = CurrentDb.OpenRecordset(sqlString, dbOpenDynaset, dbSeeChanges)
     
    If rs.RecordCount = 0 Then
        sqlString = "SELECT tbl_Commande.DateExpedition, tbl_Commande_Produit.ProduitID, tbl_Commande.DateTerminaison " & _
                        "FROM tbl_Commande_Produit INNER JOIN tbl_Commande ON tbl_Commande_Produit.CommandeID = tbl_Commande.ID_Commande " & _
                        "WHERE (((tbl_Commande_Produit.ProduitID)=" & NoProduit & "));"
        Set rs2 = CurrentDb.OpenRecordset(sqlString, dbOpenDynaset, dbSeeChanges)
     
        If rs2.RecordCount > 0 Then
            If Nz(rs2.Fields("[DateExpedition]"), 0) <> 0 Then
                If Nz(rs2.Fields("[DateTerminaison]"), 0) = 0 Then
                    tempDate1 = CalcDateTerminaison(NoProduit)
                    If tempDate1 = 0 Then
                        MsgBox "Certaine(s) date(s) nécessaire à la création de la fiche de production sont manquantes!", vbCritical, "Date manquante"
                        Exit Sub
                    Else
                        tempDate2 = "#" & Month(tempDate1) & "-" & Day(tempDate1) & "-" & Year(tempDate1) & "#"
                    End If
                    sqlString = "UPDATE tbl_Commande_Produit INNER JOIN tbl_Commande ON tbl_Commande_Produit.CommandeID = tbl_Commande.ID_Commande SET tbl_Commande.DateTerminaison = " & tempDate2 & " " & _
                                    "WHERE (((tbl_Commande_Produit.ProduitID)=" & NoProduit & "));"
     
                    CurrentDb.Execute sqlString, dbFailOnError
                    End If
                    sqlString = "UPDATE tbl_Produit SET tbl_Produit.ImpressionFicheProd = 1 " & _
                                "WHERE (((tbl_Produit.ID_Produit)=" & NoProduit & "));"
                    CurrentDb.Execute sqlString, dbFailOnError
     
     
                DoCmd.OpenReport "rpt_FicheProductionAupel", acViewPreview, , "[tbl_Produit].[ID_Produit]=" & NoProduit, , "Produit"
                DoCmd.RunCommand (acCmdZoom100)
            Else
                MsgBox "Il n'y a pas de date d'expédition!", vbCritical, "Date d'expédition"
            End If
            Else
                MsgBox "Couleur spirale manquante", vbCritical, "Couleur spirale"
            End If
            End If
        rs2.Close
     
    Else
        MsgBox "Certaine(s) date(s) nécessaire à la création de la fiche de production sont manquantes!", vbCritical, "Date manquante"
    End If
     
    rs.Close
     
     
    End Sub
     
    Je sais pas ce qui s'est passé voici le bon code.
    Voici le bon code!!!!

  12. #12
    Expert éminent sénior
    Avatar de tee_grandbois
    Homme Profil pro
    retraité
    Inscrit en
    Novembre 2004
    Messages
    8 648
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 67
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : retraité

    Informations forums :
    Inscription : Novembre 2004
    Messages : 8 648
    Points : 14 626
    Points
    14 626
    Par défaut
    Evite de répondre avec citation complète cela rend les posts illisibles.
    il y a en effet un End If en trop du coup le Else l'est aussi. Je pense que c'est celui marqué E1 :
    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
    37
    38
    39
    I1 If rs.RecordCount = 0 Then
        sqlString = "SELECT tbl_Commande.DateExpedition, tbl_Commande_Produit.ProduitID, tbl_Commande.DateTerminaison " & _
                        "FROM tbl_Commande_Produit INNER JOIN tbl_Commande ON tbl_Commande_Produit.CommandeID = tbl_Commande.ID_Commande " & _
                        "WHERE (((tbl_Commande_Produit.ProduitID)=" & NoProduit & "));"
        Set rs2 = CurrentDb.OpenRecordset(sqlString, dbOpenDynaset, dbSeeChanges)
     
    I2    If rs2.RecordCount > 0 Then
    I3        If Nz(rs2.Fields("[DateExpedition]"), 0) <> 0 Then
    I4            If Nz(rs2.Fields("[DateTerminaison]"), 0) = 0 Then
                    tempDate1 = CalcDateTerminaison(NoProduit)
    I5                If tempDate1 = 0 Then
                        MsgBox "Certaine(s) date(s) nécessaire à la création de la fiche de production sont manquantes!", vbCritical, "Date manquante"
                        Exit Sub
    X5                Else
                        tempDate2 = "#" & Month(tempDate1) & "-" & Day(tempDate1) & "-" & Year(tempDate1) & "#"
    E5                End If
                    sqlString = "UPDATE tbl_Commande_Produit INNER JOIN tbl_Commande ON tbl_Commande_Produit.CommandeID = tbl_Commande.ID_Commande SET tbl_Commande.DateTerminaison = " & tempDate2 & " " & _
                                    "WHERE (((tbl_Commande_Produit.ProduitID)=" & NoProduit & "));"
     
                    CurrentDb.Execute sqlString, dbFailOnError
    E4                End If
                    sqlString = "UPDATE tbl_Produit SET tbl_Produit.ImpressionFicheProd = 1 " & _
                                "WHERE (((tbl_Produit.ID_Produit)=" & NoProduit & "));"
                    CurrentDb.Execute sqlString, dbFailOnError
    
                DoCmd.OpenReport "rpt_FicheProductionAupel", acViewPreview, , "[tbl_Produit].[ID_Produit]=" & NoProduit, , "Produit"
                DoCmd.RunCommand (acCmdZoom100)
    X3        Else
                MsgBox "Il n'y a pas de date d'expédition!", vbCritical, "Date d'expédition"
    E3        End If
    X2        Else
                MsgBox "Couleur spirale manquante", vbCritical, "Couleur spirale"
    E2        End If
    E1        End If
        rs2.Close
     
    ?? Else
        MsgBox "Certaine(s) date(s) nécessaire à la création de la fiche de production sont manquantes!", vbCritical, "Date manquante"
    ?? End If
    Quand on est derrière l'écran on n'a aucun clavier sous les mains ...
    ah non ? donc devant l'écran c'est la connectique ?

  13. #13
    Membre à l'essai
    Homme Profil pro
    Technicien réseau
    Inscrit en
    Septembre 2017
    Messages
    52
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 59
    Localisation : Canada

    Informations professionnelles :
    Activité : Technicien réseau
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Septembre 2017
    Messages : 52
    Points : 15
    Points
    15
    Par défaut
    Salut,

    Tu partage ton prénom?

    Effectivement, j'étais à t'écrire pour te le dire.


    Je te remercie sincèrement pour ton aide!!!!!!

    Je vais mettre le post comme résolu!!!!

    Daniel ;-)

    p.s. J'ai plusieurs autres choses à changer, alors si tu veux bien.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 8
    Dernier message: 01/09/2011, 10h39
  2. [AC-2003] Mise à jour d'un sous-formulaire à partir d'une zone de liste
    Par SIENWEST dans le forum IHM
    Réponses: 3
    Dernier message: 10/03/2010, 17h10
  3. Réponses: 6
    Dernier message: 12/11/2008, 16h20
  4. Réponses: 4
    Dernier message: 12/04/2007, 16h04
  5. Réponses: 2
    Dernier message: 21/12/2005, 13h08

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo