Bonjour à toutes et à tous,

J'ai un menu général dont l'une des options est de remplir dynamiquement un tableau (sub lister()).
Une fois ce tableau rempli je souhaite "cliquer" sur un n° de devis pour en avoir le détail.
Je ne sais pas comment le faire.

Je vous joins le code et un extrait de mon fichier texte.
Par avance merci et bonne journée.

Alain
Fichier texte ecr.txt
140220131003,14/02/2013,DUPONT,123,50,10,90,2
140220131003,14/02/2013,DUPONT,456,25,20,60,3
Le code
Code html : 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
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
<FORM action=recup_input.html>
<center>
<h1>Gestion des devis</h1>
</center>
<input type="submit" value="Enregistrer un devis"
style="background-color:#330099" style="color:white; font-
weight:bold"onclick>
<button id="modif" style="background-color:#8A2BE2" style="color:white; font-
weight:bold">Rechercher référence pièce, nom client, date, etc.</button>
<button id="lister"style="background-color:#6495ED" style="color:white; font-
weight:bold">Lister tous les devis</button>
<button id="editer"style="background-color:#7FFFD4" style="color:black; font-
weight:bold">Editer un devis</button> 
</FORM>
<script type="text/vbscript">
document.getelementbyid("modif").onclick=getref("modif")
document.getelementbyid("lister").onclick=getref("lister")
document.getelementbyid("editer").onclick=getref("editer")
Const cteRapport = "c:\temp\ecr.txt"
Sub modif()
'alert("modification")
dim tableau
dim mot_cherche
dim compteur
compteur = 0
 mot_cherche = inputbox("Quel est la chaîne de caractères recherchée ?")
 mot_cherche=ucase(mot_cherche)
If mot_cherche = "" Then
        msgbox "Annuler"
		exit sub
End If 
fichier_lecture_1 = "c:\temp\ecr.txt"
Set fso = CreateObject("Scripting.FileSystemObject") 
set fichier_lecture_2 = fso.opentextfile(fichier_lecture_1, 1, true)
en_tete()
do until fichier_lecture_2.atendofstream 
chaine = fichier_lecture_2.readline()
if instr(1, chaine, mot_cherche) > 0 then
		tableau=split(chaine,",")
		document.write("<tr>")
		document.write("<td>")
		document.write tableau(0)
		document.write("</td>")
		document.write("<td>")
		document.write("<FONT COLOR='#800080' SIZE=3>")
		document.write tableau(1)		
		document.write("</td>")		
		document.write("<td>")
		document.write("<FONT COLOR='blue' SIZE=3>")
		document.write tableau(2)
		document.write("</td>")
		document.write("<td>")
		document.write("<FONT COLOR='green' SIZE=3>")
		document.write tableau(3)		
		document.write("</td>")		
		document.write("<td>")
		document.write("<FONT COLOR='maroon' SIZE=3>")
		document.write tableau(4)		
		document.write("</td>")
		document.write("<td>")
		document.write("<FONT COLOR='steelblue' SIZE=3>")
		document.write tableau(5)		
		document.write("</td>")
		document.write("<td>")
		document.write("<FONT COLOR='steelblue' SIZE=3>")
		document.write tableau(6)		
		document.write("</td>")
		document.write("</tr>")	
'tableau(0)="Date de la commande : " + tableau(0) + "  "
'tableau(1)="Référence de la pièce : " + tableau(1) + "  "
'tableau(2)="Nom du client : " + tableau(2)
	'for each x in tableau
    'document.write(x)
	'next
	'document.write("<br />")
'msgbox tableau(1)
end if
loop
document.write("</table>")
fichier_lecture_2.close 
set fichier_lecture_2 = nothing
set fso = nothing 
End Sub
sub en_tete()
document.write("<table border=1 cellspacing=1 cellpadding=5>")
document.write("<tr bgcolor='cyan'>")
Document.Write("<td>")
Document.Write("<font STYLE='text-decoration:underline' size=3>N° du devis</font>")
document.write("</td>")
Document.Write("<td>")
Document.Write("<font color='#DC143C' STYLE='text-decoration:underline' size=3>Date de la commande</font>")
document.write("</td>")
document.write("<td>")
document.write("<FONT COLOR='#800080' STYLE='text-decoration:underline' SIZE=3>Nom du client</font>")
document.write("</td>")
document.write("<td>")
'document.write("<FONT COLOR='blue' FACE='Arial, Helvetica, sans-serif' SIZE=3>Référence de la pièce</font></td>")
document.write("<FONT COLOR='blue' STYLE='text-decoration:underline' SIZE=3>Référence de la pièce</font></td>")
document.write("</td>")
document.write("<td>")
document.write("<FONT COLOR='green' STYLE='text-decoration:underline' SIZE=3>Prix catalogue</font></td>")
document.write("</td>")
document.write("<td>")
document.write("<FONT COLOR='maroon' STYLE='text-decoration:underline' SIZE=3>Remise</font></td>")
document.write("</td>")
document.write("<td>")
document.write("<FONT COLOR='steelblue' STYLE='text-decoration:underline' SIZE=3>Prix après remise</font></td>")
document.write("</td>")
document.write("<td>")
document.write("<FONT COLOR='steelblue' STYLE='text-decoration:underline' SIZE=3>Quantité</font></td>")
document.write("</td>")
document.write("</tr>")
'Document.Write("<table border=0 width=900 cellspacing=1")
'Document.Write(" <tr>")
end sub
Sub lister()
  Const ctePourLecture = 1 
  ' Nom du fichier à lire 
  Dim objFSO, objFichier, Texte, Message 
  Dim Chaine, Position 
 ' Création d'on objet pour l'accès au système de fichier 
  Set objFSO = CreateObject("Scripting.FileSystemObject")
 ' Si fichier existe 
  If ( objFSO.FileExists(cteRapport) ) Then 
  ' Création d'un objet fichier pour accès au fichier, et ouverture 
    Set objFichier = objFSO.OpenTextFile(cteRapport, ctePourLecture) 
  ' Tant que fichier n'est pas terminé
en_tete()
    While Not objFichier.AtEndOfStream 
		texte = objFichier.ReadLine
		' Recherche la position de caractère [,] 
        ' InStr(1, Texte, ",", 1) 
        ' 1 = À partir du premier caractère 
        ' Texte , texte dans lequel la recherche s'effectue 
        ' "," = Caractère recherché 
        ' 1 = Méthode de comparaison en texte  
        Position = InStr(1, Texte, ",", 1) 
        ' Capture le texte 1 caractère plus loin 
        ' donc après le [="] 
        'Texte = Mid(Texte,(Position + 1))		
		document.write("<tr>")
		document.write("<td>")
		document.write (mid(texte,1,(position-1)))
		'document.write("************")
		document.write("</td>")
		document.write("<td>")
		Texte = Mid(Texte,(Position + 1))
		Position = InStr(1, Texte, ",", 1)
		document.write("<FONT color='#DC143C' SIZE=3>")
		document.write (mid(texte,1,(position-1)))		
		document.write("</td>")	
		document.write("<td>")
		Texte = Mid(Texte,(Position + 1))
		Position = InStr(1, Texte, ",", 1)
		document.write("<FONT COLOR='#800080' SIZE=3>")
		document.write (mid(texte,1,(position-1)))		
		document.write("</td>")		
		document.write("<td>")
		Texte = Mid(Texte,(Position + 1))
		Position = InStr(1, Texte, ",", 1)
		document.write("<FONT COLOR='blue' SIZE=3>")
		document.write (mid(texte,1,(position-1)))
		document.write("</td>")
		document.write("<td>")
		Texte = Mid(Texte,(Position + 1))
		Position = InStr(1, Texte, ",", 1)
		document.write("<FONT COLOR='green' SIZE=3>")
		document.write (mid(texte,1,(position-1)))		
		document.write("</td>")		
		document.write("<td>")
		Texte = Mid(Texte,(Position + 1))
		Position = InStr(1, Texte, ",", 1)
		document.write("<FONT COLOR='maroon' SIZE=3>")
		document.write (mid(texte,1,(position-1)))		
		document.write("</td>")		
		document.write("<td>")
		Texte = Mid(Texte,(Position + 1))
		Position = InStr(1, Texte, ",", 1)
		document.write("<FONT COLOR='maroon' SIZE=3>")
		document.write (mid(texte,1,(position-1)))		
		document.write("</td>")		
		document.write("<td>")
		Texte = Mid(Texte,(Position + 1))
		'Position = InStr(1, Texte, ",", 1)
		document.write("<FONT COLOR='steelblue' SIZE=3>")
		document.write texte		
		document.write("</td>")		
		'document.write("</tr>")		
		'document.write texte
		'document.write("<br>")
        ' Enlève les 2 derniers caractères, 
        ' le caractère de saut de ligne et les guillemets 
        'Texte = Mid(Texte, 1, (Len(Texte) - 2)) 
        ' Ajoute le texte trouvé avec un saut de ligne [vbCrLf] 
        'Message = Message & vbCrLf & Texte
    Wend 
'Document.Write(" </tr>")
Document.Write("</table>")
     ' Ferme le fichier 
    objFichier.Close
     ' Libère l'objet Fichier 
    Set objFichier = Nothing
     ' Affiche à l'écran
    'msgbox Message
  Else
     ' Affiche à l'écran 
    msgbox "Fichier absent"
  End If
   ' Libère l'objet du système de fichier 
  Set objFSO = Nothing
' Quitte le script avec [0] comme paramètre 
' pour signaler "Aucune erreur" 
'WScript.Quit(0)
End Sub
sub editer()
dim total
'msgbox "coucou"
Entree = inputbox("N° de devis ?")
entree=ucase(entree)
If entree = "" Then
        msgbox "Annuler"
		exit sub
End If 
  Const ctePourLecture = 1 
  ' Nom du fichier à lire 
  Dim objFSO, objFichier, Texte, Message 
  Dim Chaine, Position 
 ' Création d'on objet pour l'accès au système de fichier 
  Set objFSO = CreateObject("Scripting.FileSystemObject")
 ' Si fichier existe 
  'If ( objFSO.FileExists(cteRapport) ) Then 
  ' Création d'un objet fichier pour accès au fichier, et ouverture 
    Set objFichier = objFSO.OpenTextFile(cteRapport, ctePourLecture) 
  ' Tant que fichier n'est pas terminé
en_tete()
mot_cherche = inputbox("Voulez-vous enlever la référence des pièces o/n ?")
mot_cherche=ucase(mot_cherche)
do until objfichier.atendofstream 
chaine = objfichier.readline()
if instr(1, chaine, entree) > 0 then
		tableau=split(chaine,",")
		document.write("<tr>")
		document.write("<td>")
		document.write tableau(0)
		document.write("</td>")
		document.write("<td>")
		document.write("<FONT COLOR='red' SIZE=3>")
		document.write tableau(1)		
		document.write("</td>")		
		document.write("<td>")
		document.write("<FONT COLOR='#800080' SIZE=3>")
		document.write tableau(2)
		document.write("</td>")
		document.write("<td>")
		document.write("<FONT COLOR='blue' SIZE=3>")
		If mot_cherche = "O" Then
			document.write "Ref pièce"
			else
			document.write tableau(3)	
		End If 	
		document.write("</td>")		
		document.write("<td>")
		document.write("<FONT COLOR='green' SIZE=3>")
		document.write tableau(4)		
		document.write("</td>")
		document.write("<td>")
		document.write("<FONT COLOR='maroon' SIZE=3>")
		document.write tableau(5)		
		document.write("</td>")
		document.write("<td>")
		document.write("<FONT COLOR='maroon' SIZE=3>")
		document.write tableau(6)		
		document.write("</td>")
		document.write("<td>")
		document.write("<FONT COLOR='steelblue' SIZE=3>")
		document.write tableau(7)
		total=total + csng(tableau(6))		
		document.write("</td>")
		document.write("</tr>")	
end if
loop
i=1
for i=1 to 6
	document.write("<td>")
	document.write("*")
	document.write("</td>")
next
document.write("<td>")
document.write "Total devis"
document.write("</td>")
document.write("<td>")
document.write("<FONT COLOR='steelblue' SIZE=3>")
document.write total
document.write("</td>")
document.write("</table>")
objFichier.close 
set objFichier = nothing
set fso = nothing 
end sub
</script>