![]() |
| Le forum de référence en programmation et développement. Articles, cours et tutoriels du débutant au chef de projet et DBA confirmé. | |||||||
|
|||||||
![]() |
|
|
Outils de la discussion |
|
|
#1 (permalink) |
|
Membre habitué
![]() Date d'inscription: avril 2008
Localisation: Tarbes
Âge: 25
Messages: 147
|
Bonjour,
J'essaie de créer une fonction qui ne permet de vérifier s'il existe une valeur dans un champ fils pour une valeur d'un champ père. Je sais c'est pas clair, je m'explique. J'ai un tableau croisé qui a champs colonnes "Année" et "semaine" et je veux vérifier s'il existe la semaine X pour l'année Y dans mon tableau. Voici mon code : Code :
Public Function ItemOfPivotTable(ByRef pivtable As PivotTable, ByVal nompivfield As String, ByVal valpar As String, Optional valchi As String = "") As Boolean Dim pivfield As PivotField Dim pivitem As PivotItem Dim tfparent As Boolean Dim tfchield As Boolean 'Initialisation tfparent = False tfchield = True ItemOfPivotTable = False 'Selection du champ à controler Set pivfield = pivtable.PivotFields(nompivfield) 'Controler la present de la valeur dans le champ père For Each pivitem In pivfield.PivotItems If pivitem.Name = valpar Then tfparent = True Next If Not valchi = "" and tfparent Then tfchield = False 'C'est cette boucle qui ne fonctionne pas For Each pivitem In pivfield.PivotItems(valpar).ChildItems If pivitem.Name = valchi Then tfchield = True Next End If Set pivfield = Nothing Set pivitem = Nothing ItemOfPivotTable = tfparent And tfchield End Function Cordialement
__________________
Etant philosophe, j'ai un problème pour chaque solution. [R. Zend] Dernière modification par psykodumarteau ; 03/07/2008 à 09h23 |
|
|
|
|
|
#2 (permalink) |
|
Membre habitué
![]() Date d'inscription: avril 2008
Localisation: Tarbes
Âge: 25
Messages: 147
|
Bonjour,
j'essaie de rajouter le code suivant avant la bloque qui ne fonctionne pas. Code :
Set pivitem = pivfield.PivotItems(valpar) MsgBox pivitem.ChildItems(1).Name Code :
Set pivitem = pivfield.PivotItems(valpar) Set pivitems = pivitem.ChildItems MsgBox pivitems.Item(1) Je ne comprend pas pourquoi il n'arrive pas à lire cette propriété (la source de mon tableau croisé dynamique n'est pas une source OLAP) Cordialement
__________________
Etant philosophe, j'ai un problème pour chaque solution. [R. Zend] |
|
|
|
|
![]() |
![]() |
||
Problème de TCD : ChildItems ne fonctionne pas
|
||
| Outils de la discussion | |
|
|