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 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
| Private Sub Commande82_Click()
DoCmd.SetWarnings False
liste.Requery
liste.Value =[liste].[ItemData]([liste].[ListCount] - 1)
If ID_TRSP.Value <> "" Or ID_FOUR.Value <> "" Then
If REF_EMBAL.Value <> "" And CMR.Value <> "" And DATE_R.Value <> "" Then
If liste.Value <> "" Then
MsgBox "Cet emballage existe déjà.", vbExclamation, "Attention"
REF_EMBAL.Value = ""
Exit Sub
Else
If (Code.Value <> "") Then
reception1.Value = 1
num.Value = 1
code_ini.Value = Code.Value
deconsigne_ini.Value = deconsigne.Value
consigne_ini.Value = consigne.Value
DoCmd.RunSQL "insert into reception (MAJ_REC,UTIL_REC,TRSP_REC,FOUR_REC,DATE_REC,BON_REC,CMR_REC,NUM_REC,EMBAL_REC,DEC_REC,CON_REC,ETAT_REC)values(now(),currentuser(),ID_TRSP,ID_FOUR,DATE_R,REF_EMBAL,CMR,num,code_ini,nz(deconsigne_ini,0),nz(consigne_ini,0),reception1)", -1
End If
If (Code1.Value <> "") Then
reception1.Value = 1
num.Value = 2
code_ini.Value = Code1.Value
deconsigne_ini.Value = deconsigne1.Value
consigne_ini.Value = consigne1.Value
DoCmd.RunSQL "insert into reception (MAJ_REC,UTIL_REC,TRSP_REC,FOUR_REC,DATE_REC,BON_REC,CMR_REC,NUM_REC,EMBAL_REC,DEC_REC,CON_REC,ETAT_REC)values(now(),currentuser(),ID_TRSP,ID_FOUR,DATE_R,REF_EMBAL,CMR,num,code_ini,nz(deconsigne_ini,0),nz(consigne_ini,0),reception1)", -1
End If
If (Code2.Value <> "") Then
reception1.Value = 1
num.Value = 3
code_ini.Value = Code2.Value
deconsigne_ini.Value = deconsigne2.Value
consigne_ini.Value = consigne2.Value
DoCmd.RunSQL "insert into reception (MAJ_REC,UTIL_REC,TRSP_REC,FOUR_REC,DATE_REC,BON_REC,CMR_REC,NUM_REC,EMBAL_REC,DEC_REC,CON_REC,ETAT_REC)values(now(),currentuser(),ID_TRSP,ID_FOUR,DATE_R,REF_EMBAL,CMR,num,code_ini,nz(deconsigne_ini,0),nz(consigne_ini,0),reception1)", -1
End If
If (code3.Value <> "") Then
reception1.Value = 1
num.Value = 4
code_ini.Value = code3.Value
deconsigne_ini.Value = deconsigne3.Value
consigne_ini.Value = consigne3.Value
DoCmd.RunSQL "insert into reception (MAJ_REC,UTIL_REC,TRSP_REC,FOUR_REC,DATE_REC,BON_REC,CMR_REC,NUM_REC,EMBAL_REC,DEC_REC,CON_REC,ETAT_REC)values(now(),currentuser(),ID_TRSP,ID_FOUR,DATE_R,REF_EMBAL,CMR,num,code_ini,nz(deconsigne_ini,0),nz(consigne_ini,0),reception1)", -1
End If
If (code4.Value <> "") Then
reception1.Value = 1
num.Value = 5
code_ini.Value = code4.Value
deconsigne_ini.Value = deconsigne4.Value
consigne_ini.Value = consigne4.Value
DoCmd.RunSQL "insert into reception (MAJ_REC,UTIL_REC,TRSP_REC,FOUR_REC,DATE_REC,BON_REC,CMR_REC,NUM_REC,EMBAL_REC,DEC_REC,CON_REC,ETAT_REC)values(now(),currentuser(),ID_TRSP,ID_FOUR,DATE_R,REF_EMBAL,CMR,num,code_ini,nz(deconsigne_ini,0),nz(consigne_ini,0),reception1)", -1
End If
If (code5.Value <> "") Then
reception1.Value = 1
num.Value = 6
code_ini.Value = code5.Value
deconsigne_ini.Value = deconsigne5.Value
consigne_ini.Value = consigne5.Value
DoCmd.RunSQL "insert into reception (MAJ_REC,UTIL_REC,TRSP_REC,FOUR_REC,DATE_REC,BON_REC,CMR_REC,NUM_REC,EMBAL_REC,DEC_REC,CON_REC,ETAT_REC)values(now(),currentuser(),ID_TRSP,ID_FOUR,DATE_R,REF_EMBAL,CMR,num,code_ini,nz(deconsigne_ini,0),nz(consigne_ini,0),reception1)", -1
End If
If (code6.Value <> "") Then
reception1.Value = 1
num.Value = 7
code_ini.Value = code6.Value
deconsigne_ini.Value = deconsigne6.Value
consigne_ini.Value = consigne6.Value
DoCmd.RunSQL "insert into reception (MAJ_REC,UTIL_REC,TRSP_REC,FOUR_REC,DATE_REC,BON_REC,CMR_REC,NUM_REC,EMBAL_REC,DEC_REC,CON_REC,ETAT_REC)values(now(),currentuser(),ID_TRSP,ID_FOUR,DATE_R,REF_EMBAL,CMR,num,code_ini,nz(deconsigne_ini,0),nz(consigne_ini,0),reception1)", -1
End If
If (code7.Value <> "") Then
reception1.Value = 1
num.Value = 8
code_ini.Value = code7.Value
deconsigne_ini.Value = deconsigne7.Value
consigne_ini.Value = consigne7.Value
DoCmd.RunSQL "insert into reception (MAJ_REC,UTIL_REC,TRSP_REC,FOUR_REC,DATE_REC,BON_REC,CMR_REC,NUM_REC,EMBAL_REC,DEC_REC,CON_REC,ETAT_REC)values(now(),currentuser(),ID_TRSP,ID_FOUR,DATE_R,REF_EMBAL,CMR,num,code_ini,nz(deconsigne_ini,0),nz(consigne_ini,0),reception1)", -1
End If
If (code8.Value <> "") Then
reception1.Value = 1
num.Value = 9
code_ini.Value = code8.Value
deconsigne_ini.Value = deconsigne8.Value
consigne_ini.Value = consigne8.Value
DoCmd.RunSQL "insert into reception (MAJ_REC,UTIL_REC,TRSP_REC,FOUR_REC,DATE_REC,BON_REC,CMR_REC,NUM_REC,EMBAL_REC,DEC_REC,CON_REC,ETAT_REC)values(now(),currentuser(),ID_TRSP,ID_FOUR,DATE_R,REF_EMBAL,CMR,num,code_ini,nz(deconsigne_ini,0),nz(consigne_ini,0),reception1)", -1
End If
If (code9.Value <> "") Then
reception1.Value = 1
num.Value = 10
code_ini.Value = code9.Value
deconsigne_ini.Value = deconsigne9.Value
consigne_ini.Value = consigne9.Value
DoCmd.RunSQL "insert into reception (MAJ_REC,UTIL_REC,TRSP_REC,FOUR_REC,DATE_REC,BON_REC,CMR_REC,NUM_REC,EMBAL_REC,DEC_REC,CON_REC,ETAT_REC)values(now(),currentuser(),ID_TRSP,ID_FOUR,DATE_R,REF_EMBAL,CMR,num,code_ini,nz(deconsigne_ini,0),nz(consigne_ini,0),reception1)", -1
End If
Me![ID_TRSP].SetFocus
'MsgBox ("Enregistrement réussi!!!")
End If
Else: MsgBox "Enregistrement Annulé: un champ est vide", vbExclamation, "Attention"
Me![DATE_R].SetFocus
Exit Sub
End If
Else: MsgBox "Enregistrement Annulé: champ transporteur ou fournisseur vide", vbExclamation, "Attention"
Me![ID_TRSP].SetFocus
Exit Sub
End If
DoCmd.Close acForm, "RECEPTION"
DoCmd.OpenForm "RECEPTION", acNormal, , , acFormAdd
End Sub |