Bonjour à tous.
Dans une requête j'ai plusieurs champs numérique. exemple Champ1 : champ2: champ3. etc....
Ces champ sont trier par une fonction Trie (ci-dessous)
Dans la même requête les champ sont donc trier: Champ_1: trie("1";[Champ1];[Champ2];[Champ3]) autre champ Champ_2: trie("2";[Champ1];[Champ2];[Champ3]) et Champ_3: trie("3";[Champ1];[Champ2];[Champ3]).
Comment faire pour que Champ_1 et Champ_2 et Champ_3 soit en format numérique car actuellement il sont en Texte.
Merci de votre aide.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Function Trie(ordre As Variant, ParamArray x() As Variant) As Variant Dim y As Variant Dim Tempo As Variant Dim boucle As Long Dim boucle2 As Long y = x() For boucle = 0 To UBound(x) For boucle2 = boucle + 1 To UBound(x) If y(boucle2) < y(boucle) Or IsNull(y(boucle2)) Then Tempo = y(boucle2) y(boucle2) = y(boucle) y(boucle) = Tempo End If Next boucle2 Next boucle If IsNumeric(ordre) And ordre <= UBound(y) + 1 And ordre > 0 Then Trie = y(Int(ordre) - 1) Else Tempo = "" For boucle = 0 To UBound(y) If IsNull(y(boucle)) Then Tempo = Tempo & "null" & "/" Else Tempo = Tempo & y(boucle) & "/" End If Next boucle Trie = Left(Tempo, Len(Tempo) - 1) End If End Function
Partager