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
| Private Sub Commande34_Click()
Dim NuSi As String
Dim NuCl As String
Dim NoSo As String
Dim PrPc As String
Dim NuRu As String
Dim NoRu As String
Dim CoPo As String
Dim Vill As String
Dim Tele As String
Dim Emai As String
Dim NuCo As String
Dim DaSi As String
Dim Gest As String
Dim NoMi As String
Dim NoSi As String
Dim ReAx As String
Dim Bran As String
Dim Requete As String
Dim oDb As dao.Database
Dim oRstClasse As dao.Recordset
Dim Rst As dao.Recordset
Dim Rst1 As dao.Database
Dim strSQL As String
'recupération des info du formulaire
NuSi = Me.Controls("Numéro Sinistre").Value
NuCl = Me.Controls("Numéro de client").Value
NoSo = Me.Controls("Nom/Société").Value
PrPc = Me.Controls("Prénom/Personne de contact").Value
NuRu = Me.Controls("N°, Rue").Value
CoPo = Me.Controls("Code Postal").Value
Vill = Me.Controls("Ville").Value
Tele = Me.Controls("Téléphone").Value
Emai = Me.Controls("Email").Value
NuCo = Me.Controls("Numéro contrat").Value
DaSi = Me.Controls("Date sinistre").Value
NoMi = Me.Controls("Gestionnaire").Value
NoSi = Me.Controls("Note Sinistre").Value
ReAx = Me.Controls("Reserve Axa").Value
Bran = Me.Controls("Branche").Value
' Le client existe?
Set oDb = CurrentDb
Set Rst1 = Inspecteur_BDD1111009.OpenRecordset("SELECT * FROM Personne WHERE Personne.NClient = NuCl", dbReadOnly)
Debug.Print Rst1
If IsNull(Rst1) Then
' Ouvrir la table en lecture/écriture
Set Rst = CurrentDb.OpenRecordset("Personne", dbOpenDynaset)
' Créer un enregistrement dans la table
Rst.AddNew
' Alimenter les champs
Rst.Fields("NClient").Value = NuCl
Rst.Fields("Nom/Société").Value = NoSo
Rst.Fields("Prénom/personne contact").Value = PrPc
Rst.Fields("N°, Rue").Value = NuRu
Rst.Fields("Code Postal").Value = CoPo
Rst.Fields("Ville").Value = Vill
Rst.Fields("Téléphone").Value = Tele
Rst.Fields("Email").Value = Emai
' Valider
Rst.Update
Rst.Close
' Ouvrir la table en lecture/écriture
Set Rst = CurrentDb.OpenRecordset("Fusion", dbOpenDynaset)
' Créer un enregistrement dans la table
Rst.AddNew
' Alimenter les champs
Rst.Fields("NSinistre").Value = NuSi
Rst.Fields("NContrat").Value = NuCo
Rst.Fields("Date Sinistre").Value = DaSi
Rst.Fields("NClient").Value = NuCl
Rst.Fields("Note Sinistre").Value = NoSi
Rst.Fields("Estimation/Réserve Axa").Value = ReAx
Rst.Fields("Gestionnaire").Value = NoMi
Rst.Fields("Branche").Value = Bran
' Valider
Rst.Update
MsgBox "Mission envoyée, Merci !", vbInformation
Rst.Close
Rst1.Close
Set Rst = Nothing
Set Rst1 = Nothing
Else
' Ouvrir la table en lecture/écriture
Set Rst = CurrentDb.OpenRecordset("Fusion", dbOpenDynaset)
' Créer un enregistrement dans la table
Rst.AddNew
' Alimenter les champs
Rst.Fields("NSinistre").Value = NuSi
Rst.Fields("NContrat").Value = NuCo
Rst.Fields("Date Sinistre").Value = DaSi
Rst.Fields("NClient").Value = Rst1
Rst.Fields("Note Sinistre").Value = NoSi
Rst.Fields("Estimation/Réserve Axa").Value = ReAx
Rst.Fields("Gestionnaire").Value = NoMi
Rst.Fields("Branche").Value = Bran
' Valider
Rst.Update
MsgBox "Mission envoyée, Merci !", vbInformation
Rst.Close
Rst1.Close
Set Rst = Nothing
Set Rst1 = Nothing
End If
End Sub |
Partager