Envoyé par
Dano60
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
Partager