Bonsoir,
J'ai un code VB afin de generer un planning en fonction d'une base de donnée.
Lors de l'execution de mon code cela genere le code erreur 91 variable objet ou variable bloc with non defini er me surligne la ligne
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
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 Private Sub Form_Load() Dim i As Integer Semaine = frmMenu.iSemaine i = 0 Caption = "Semaine : " & Semaine 'Requête SQL pour chercher les données qui correspondent à la semaine choisie adodc1.RecordSource = "SELECT * FROM Planning WHERE Semaine =" & Semaine With adodc1 If Not .Recordset.EOF Then 'Remplissage de la première ligne '{ If Not IsNull(.Recordset("Personne")) Then lblNom(0).Caption = .Recordset("Personne") If Not IsNull(.Recordset("Lundi")) Then txtLundi(0).Text = .Recordset("Lundi") If Not IsNull(.Recordset("Mardi")) Then txtMardi(0).Text = .Recordset("Mardi") If Not IsNull(.Recordset("Mercredi")) Then txtMercredi(0).Text = .Recordset("Mercredi") If Not IsNull(.Recordset("Jeudi")) Then txtJeudi(0).Text = .Recordset("Jeudi") If Not IsNull(.Recordset("Vendredi")) Then txtVendredi(0).Text = .Recordset("Vendredi") If Not IsNull(.Recordset("Samedi")) Then txtSamedi(0).Text = .Recordset("Samedi") If Not IsNull(.Recordset("Dimanche")) Then txtDimanche(0).Text = .Recordset("Dimanche") '} 'Création et remplissage des autres lignes de données '{ Do While Not DataPlanning.Recordset.EOF 'Index de création i = i + 1 'Aller à l'enregistrement suivant DataPlanning.Recordset.MoveNext 'Si ce n'est pas le dernier enregistrement : If DataPlanning.Recordset.EOF Then Exit Do 'Créer une nouvelle ligne de controles (Labels et Zones de Texte) Load lblNom(i) Load txtLundi(i) Load txtMardi(i) Load txtMercredi(i) Load txtJeudi(i) Load txtVendredi(i) Load txtSamedi(i) Load txtDimanche(i) 'Positionnement et Affichage des controles créés lblNom(i).Top = lblNom(i - 1).Top + lblNom(i).Height lblNom(i).Visible = True txtLundi(i).Top = lblNom(i).Top txtLundi(i).Visible = True txtMardi(i).Top = lblNom(i).Top txtMardi(i).Visible = True txtMardi(i).ZOrder 0 txtMercredi(i).Top = lblNom(i).Top txtMercredi(i).Visible = True txtMercredi(i).ZOrder 0 txtJeudi(i).Top = lblNom(i).Top txtJeudi(i).Visible = True txtJeudi(i).ZOrder 0 txtVendredi(i).Top = lblNom(i).Top txtVendredi(i).Visible = True txtVendredi(i).ZOrder 0 txtSamedi(i).Top = lblNom(i).Top txtSamedi(i).Visible = True txtSamedi(i).ZOrder 0 txtDimanche(i).Top = lblNom(i).Top txtDimanche(i).Visible = True txtDimanche(i).ZOrder 0 fraPlanning.Height = fraPlanning.Height + txtLundi(0).Height + 20 'Remplissage de la nouvelle ligne '{ If Not IsNull(.Recordset("Personne")) Then lblNom(i).Caption = .Recordset("Personne") If Not IsNull(.Recordset("Lundi")) Then txtLundi(i).Text = .Recordset("Lundi") If Not IsNull(.Recordset("Mardi")) Then txtMardi(i).Text = .Recordset("Mardi") If Not IsNull(.Recordset("Mercredi")) Then txtMercredi(i).Text = .Recordset("Mercredi") If Not IsNull(.Recordset("Jeudi")) Then txtJeudi(i).Text = .Recordset("Jeudi") If Not IsNull(.Recordset("Vendredi")) Then txtVendredi(i).Text = .Recordset("Vendredi") If Not IsNull(.Recordset("Samedi")) Then txtSamedi(i).Text = .Recordset("Samedi") If Not IsNull(.Recordset("Dimanche")) Then txtDimanche(i).Text = .Recordset("Dimanche") '} 'Fin de la boucle 'DO' Loop Else 'Si pas d'enregistrement pour la semaine choisie 'Affichage d'un message MsgBox "Pas de Planning pour la Semaine : " & Semaine, vbInformation End If End With End Sub
Etant un novice en VB vous serez t'il possible de m'aider.
Code : Sélectionner tout - Visualiser dans une fenêtre à part If Not .Recordset.EOF Then
Merci
Partager