VBA Access Recordset
Résolu
eljojo_e
Messages postés
1155
Date d'inscription
Statut
Membre
Dernière intervention
-
f894009 Messages postés 17277 Date d'inscription Statut Membre Dernière intervention -
f894009 Messages postés 17277 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
J'ai fait un code qui va chercher des info dans plusieurs tables :
Toutes les boucle fonctionne sauf la boucle sur "TOS" me met comme erreur : "Erreur de compilation : Membre de méthode ou de données introuvable" en surlignant
J'ai tout essayé, j'ai regarder chaque nomination de chaque champ et tout concorde...
Pouvez-vous m'aider ?
Merci
Le geek ne descend pas du métro, il libère la rame.
J'ai fait un code qui va chercher des info dans plusieurs tables :
Private Sub MAJ_Click() 'DoCmd.Hourglass True Dim TxUrba, TProjet, TListeCom, TConv, TPCT, TReunion, TProcedure, TPhase, TOS As Recordset Dim cTxUrba, cTProjet, cTListeCom, cTConv, cTPCT, cTReunion, cTProcedure, cTPhase, cTOS As Integer Set data_base = OpenDatabase("Y:\SERVICES TECHNIQUES\SI\GTI\GTI Source.mdb") Set TxUrba = data_base.OpenRecordset("T Travaux urba", dbOpenDynaset) Set TProjet = data_base.OpenRecordset("T Projet", dbOpenDynaset) Set TListeCom = data_base.OpenRecordset("T Liste des communes", dbOpenDynaset) Set TConv = data_base.OpenRecordset("T Conventions", dbOpenDynaset) Set TPCT = data_base.OpenRecordset("T PCT", dbOpenDynaset) Set TReunion = data_base.OpenRecordset("T Réunions", dbOpenDynaset) Set TProcedure = data_base.OpenRecordset("T Procédures Administratives", dbOpenDynaset) Set TPhase = data_base.OpenRecordset("T Phases Techniques", dbOpenDynaset) Set TOS = data_base.OpenRecordset("T OS", dbOpenDynaset) TxUrba.MoveLast cTxUrba = TxUrba.RecordCount 'obligé de faire un MoveLast sinon RecordCount fonctionne pas ... TProjet.MoveLast cTProjet = TProjet.RecordCount TListeCom.MoveLast cTListeCom = TListeCom.RecordCount TConv.MoveLast cTConv = TConv.RecordCount TPCT.MoveLast cTPCT = TPCT.RecordCount TReunion.MoveLast cTReunion = TReunion.RecordCount TProcedure.MoveLast cTProcedure = TProcedure.RecordCount TPhase.MoveLast cTPhase = TPhase.RecordCount TOS.MoveLast cTOS = TOS.RecordCount 'Met à jour les champs de la table Travaux urba TxUrba.MoveFirst For a = 1 To cTxUrba 'MAJ Date piquetage TReunion.MoveFirst For b = 1 To cTReunion If TReunion.[Code Projet] = TxUrba.[Projet] Then If TReunion.[Motif] = "Piquetage Electrique" Then TxUrba.Edit TxUrba.[Date piquetage] = TReunion.[Date] TxUrba.Update End If End If TReunion.MoveNext Next 'MAJ Diffusion art2 TProcedure.MoveFirst For b = 1 To cTProcedure If TProcedure.[Code Projet] = TxUrba.[Projet] Then If TProcedure.[Type Procedure] = "Article 2" Then TxUrba.Edit TxUrba.[Diffusion art 2] = TProcedure.[Date Dépôt Procedure] TxUrba.Update End If End If TProcedure.MoveNext Next 'MAJ Début des travaux T OS TOS.MoveFirst For b = 1 To cTOS If TOS.[Code Projet] = TxUrba.[Projet] Then If TOS.[BC / OS] = 1 Then If TOS.[Type OS] = "Commencement des travaux" Then TxUrba.Edit TxUrba.[Début TX] = TOS.[Date Date limite de début] TxUrba.Update End If End If End If TOS.MoveNext Next 'MAJ Memoire 1 & 2 TProjet.MoveFirst For b = 1 To cTProjet If TProjet.[Code Projet] = TxUrba.[Projet] Then TxUrba.Edit TxUrba.[Mémoire 1] = TProjet.[Memoire1Urba] TxUrba.[Mémoire 2] = TProjet.[MemoireFinalUrba] TxUrba.Update End If TProjet.MoveNext Next 'MAJ AMEO TPhase.MoveFirst For b = 1 To cTPhase If TPhase.[Code Projet] = TxUrba.[Projet] Then If TPhase.[Type Phase] = "Date AMEO" Then TxUrba.Edit TxUrba.[Date AMEO] = TPhase.[Date] TxUrba.Update End If End If TPhase.MoveNext Next 'MAJ PCT TPCT.MoveFirst For b = 1 To cTPCT If TPCT.[GTI] = TxUrba.[Projet] Then TxUrba.Edit TxUrba.[PCT pour paiement] = TPCT.[Date envoie BE] TxUrba.[Date Paiement] = TPCT.[Date Paiement] TxUrba.[Catégorie] = TPCT.[Cadre juridique] TxUrba.[Date envoi PCT pour étude] = TPCT.[Date création] TxUrba.Update End If TPCT.MoveNext Next TxUrba.MoveNext Next TxUrba.Close TProjet.Close TListeCom.Close TConv.Close TPCT.Close TReunion.Close TProcedure.Close TPhase.Close TOS.Close 'DoCmd.Hourglass False End Sub
Toutes les boucle fonctionne sauf la boucle sur "TOS" me met comme erreur : "Erreur de compilation : Membre de méthode ou de données introuvable" en surlignant
.[Code Projet] de la ligne If TOS.[Code Projet] = TxUrba.[Projet] Then
J'ai tout essayé, j'ai regarder chaque nomination de chaque champ et tout concorde...
Pouvez-vous m'aider ?
Merci
Le geek ne descend pas du métro, il libère la rame.
A voir également:
- VBA Access Recordset
- Acer quick access ✓ - Forum PC portable
- Acer Quick Access - affichage CapsLock, VerrNum - Forum logiciel systeme
- Désinstaller ACER QUICK ACCESS - Forum Logiciels
- Access appdata - Guide
- Excel compter cellule couleur sans vba - Guide
possible d'avoir la base meme partielle ???
Sinon j'utilise aussi dlookup mais j'ai trois conditions ... y a pas une autre solution ?
votre code est correctement ecrit, dlookup multi-criteres c'est ok, mais n'arrangera peut-etre pas le probleme
Sinon une requête sql ?
C'est la première que j'écris du SQL, évidemment elle ne fonctionne pas... vous pouvez m'aider svp ?