me familiarisant avec datareport et adodc j'execute le code suivant qui me génère le message d'erreur: erreur d'execution 424 un objet est requis suivant après un clic sur le bouton command1j'avoue que j'ai pris compros grande chose en allant sur l'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
30
31 Private Sub Command1_Click() Dim q As Integer Dim intctrl As Integer Dim x As Integer Dim z As Integer x = 0 q = 0 z = 0 With dr .Hide ' Set dr.DataSource = rs Set .DataSource = rs '.DataSource = rs .DataMember = " " With .Sections("section1").Controls For intctrl = 1 To .Count If TypeOf .Item(intctrl) Is RptLabel Then .Item(intctrl).Caption = rs.Fields(q).Name & " : " q = q + 1 End If If TypeOf .Item(intctrl) Is RptTextBox Then .Item(intctrl).DataMember = "" .Item(intctrl).DataField = "" z = z + 1 End If Next intctrl End With .Refresh .Show End With End Sub
c'est la l'instructionqui est souligné en jaune
Code : Sélectionner tout - Visualiser dans une fenêtre à part set. datasource= rs
voici le code que je mets au chargement de la feuillemerci de me signifier ce qui coince
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 Private Sub Form_Load() Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset Dim cmD As New ADODB.Command Command1.Caption = " show report" cn.Open "provider=microsoft.jet.oledb.4.0;data source=c:\program files\microsoft visual studio\vb98\nwind.mdb;" With cmD .ActiveConnection = cn .CommandType = adCmdText .CommandText = "select nom,prénom from employés" .Execute End With With rs .ActiveConnection = cn .CursorLocation = adUseClient .Open cmD End With End Sub
Partager