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
|
Private Sub case_AfterUpdate()
'déclaration variables
Dim db As DAO.Database, rst As DAO.Recordset, fld As DAO.Field
Dim msg As String
Dim temp_fournisseur As String
Dim num_rap As String
'Si la case est cochée alors message de confirmation Yes/No
If [case] = True Then
msg = MsgBox(" OK ? ", vbQuestion + vbYesNo)
'Si la réponse est Oui
If msg = vbYes Then
DoCmd.RunCommand acCmdSaveRecord
temp_fournisseur = ("SELECT num_rapport, Equipement, Inspector, Code_Supplier, No_IPS, Nom_affaire, Unite, Item, No_serie, nature_controle, societe, Fournisseur, No_affaire, case, Adresse_inspection, Adresse_emballage, No_poste, No_commande, No_modification FROM Temp WHERE ([case] = -1);")
'Création du recordset (nécesaires pour les requêtes de selection)
Set db = CurrentDb()
Set rst = CurrentDb.OpenRecordset(temp_fournisseur)
'Affectation du Temp.num_rapport dans une variable
num_rap = rst.Fields("num_rapport")
'Attribution des éléments récupérés dans les différents champs
Form_Cover.fournisseur = rst.Fields("Fournisseur")
Form_Cover.Description = rst.Fields("Equipement")
Form_Cover.inspecteur = rst.Fields("Inspector")
Form_Cover.No_projet = rst.Fields("No_affaire")
Form_Cover.Projet = rst.Fields("Nom_affaire")
Form_Cover.unite = rst.Fields("Unite")
Form_Cover.Item = rst.Fields("Item")
Form_Cover.No_serie = rst.Fields("No_serie")
Form_Cover.type_inspection = rst.Fields("nature_controle")
Form_Cover.company_name = rst.Fields("societe")
Form_Cover.No_rapport = rst.Fields("num_rapport")
Form_Cover.adresse_inspection = rst.Fields("Adresse_inspection")
Form_Cover.adresse_emballage = rst.Fields("Adresse_emballage")
Form_Cover.No_poste = rst.Fields("No_poste")
Form_Cover.No_commande = rst.Fields("No_commande")
Form_Cover.No_avenant = rst.Fields("No_modification")
'Form_Cover = rst.Fields("Code_Supplier")
'Form_Cover = rst.Fields("No_IPS")
'Form_Cover.Date_inspection_realisee = rst.Fields("date_inspec_confirmee")
'Form_Cover = rst.Fields("liste_diffusion")
'Form_Formulaire1.No_rapport = rst.Fields("num_rapport")
rst.Close
DoCmd.Close
'Si réponse = Non
Else
If (msg = vbNo) Then
Exit Sub
End If
End If
End If
End Sub |
Partager