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
|
Private Sub Commande62_Click()
On Error GoTo Err_Commande62_Click
Dim db As DAO.Database
Dim rst As DAO.Recordset
' Ouvrir un Recordset basé sur tbl Sociétés
Set db = CurrentDb()
Set rst = db.OpenRecordset("tbl Finale")
' Ajouter un enregistrement
rst.AddNew
rst("RefDeclaration") = Me.RefDeclaration.Value
rst("CodeSociete") = Me.CodeSociete.Value
rst("CodePhase") = Me.CodePhase.Value
rst("DateDeclaration") = Me.DateDeclaration.Value
rst("CodeDeclarant") = Me.CodeDeclarant.Value
rst("CodeProduit") = Me.CodeProduit.Value
rst("CIF") = Me.CIF.Value
rst("PoidsProduit") = Me.PoidsProduit.Value
rst("Tally") = Me.Tally.Value
rst("Transit Documents") = Me.Transit_Documents.Value
rst("PV ANR") = Me.PV_ANR.Value
rst("AdmOps") = Me.AdmOps.Value
rst("Assistance") = Me.Assistance.Value
rst("Escort") = Me.Escort.Value
rst("Bank charges") = Me.Bank_charges.Value
rst("prints") = Me.prints.Value
rst("Frais enregistrement") = Me.Frais_enregistrement.Value
rst("Bon à enlever") = Me.Bon_à_enlever.Value
rst("TauxPhase") = Me.TauxPhase.Value
rst("TauxHonoraires") = Me.Honorraires.Value
rst("IcaDeclarant") = Me.ICA.Value
rst("CodeTarifs") = Me.CodeTarif.Value
rst("TauxTarifs") = Me.TauxTarif.Value
rst("Ofidas") = Me.OFIDA.Value
rst("Occs") = Me.Occ.Value
rst("DIVERSs") = Me.DiversTaxes.Value
rst("MontanHonorairess") = Me.MontantHonoraires.Value
rst("TotaTaxes") = Me.TotalFact.Value
rst("MontantHonorairesNet") = Me.HonorairesNet.Value
rst.Update
' Fermer le Recordset
rst.Close
Set rst = Nothing
Set db = Nothing
Exit_Commande62_Click:
Exit Sub
Err_Commande62_Click:
' Si l'erreur est due à un doublon, la fonction affiche un message permettant d'annuler une commande.
Const ERR_DOUBLON = 3022 ' erreur de doublon
' DataErr reçoit le code erreur de la part du moteur de la bdd ou de l'interface
Select Case DataErr
Case ERR_DOUBLON
'Votre message...
MsgBox "cette facture existe ", vbExclamation, "Attention"
'La zone a surveiller
[RefDeclaration].SetFocus
'Demande à Access de continuer l'exécution sans afficher le message standard
Response = acDataErrContinue
End Select
Resume Exit_Commande62_Click
End Sub |
Partager