Rafraichir datareport.La solution ? A vous de voir...

STKPO2P Messages postés 3 Date d'inscription dimanche 25 janvier 2004 Statut Membre Dernière intervention 27 avril 2005 - 27 avril 2005 à 23:16
MAOUHOUB1980 Messages postés 1 Date d'inscription samedi 11 février 2012 Statut Membre Dernière intervention 16 février 2012 - 16 févr. 2012 à 18:49
Salut,


voici un bout de code que j'ai trouvé sur le site de microsoft afin de rafraichir un datareport
lié à une base de données....beaucoup doivent galérer comme moi alors lisez ce qui suit...
c'est en anglais
mais en gros il faut mettre le code suivant dans la procédure d'appel du datareport (ici le bouton de commande):


***************************************
Private Sub Command1_Click()
Load DataEnvironment1
With DataEnvironment1
If .rsCommand1.State <> 0 Then .rsCommand1.Close

End With
DataReport1.Refresh
If DataReport1.Visible = False Then DataReport1.Show
End Sub
********************************************


pour moi ça marche sous vb6
je pense que vous ne devez pas oublier les préférences du projet ayant rapport avec les datareports
sinon ben ça marche pas....


Bonne programmations à tous....


lien vers le site que j'ai trouvé


http://support.microsoft.com/default.aspx?scid=kb;en-us;244779





Article original**********************************************
*******************************************************
How To Refresh a Parameterized DataReport



1. Open a new Standard EXE Project in Microsoft Visual Basic. Form1 is created by default.
2. Add a DataEnvironment (DataEnvironment1) and a DataReport (DataReport1) to the project.
3. Add a Connection (Connection1) to the DataEnvironment pointing to NWIND.MDB (or Northwind.MDB) through the Microsoft Jet 4.0 OLE DB Provider.
4. Add a Command (Command1) to Connection1, with the following properties:
CommandType: adCommandText
CommandText: Select * From Employees Where HireDate < ?
In the Parameters tab:
Name: pDate
Direction: Input
Data Type: adDBTimeStamp
Host Data Type: Date (VT_DATE)
5. In the DataReport, set the following properties:
DataSource: DataEnvironment1
DataMember: Command1
6. Drag the following fields from the DataEnvironment into the Detail section of the DataReport:
EmployeeID
FirstName
LastName
HireDate
7. Add a TextBox (Text1) and a CommandButton (Command1) to the form. Add the following code:Option Explicit
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub Command1_Click()
Load DataEnvironment1
With DataEnvironment1
If .rsCommand1.State <> 0 Then .rsCommand1.Close

End With
DataReport1.Refresh
If DataReport1.Visible = False Then DataReport1.Show
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

8. Save the project and run it. Enter the following dates in the TextBox and click the CommandButton after each one:
1/1/95
1/1/94
1/1/93
1/1/92
You can see the report refresh showing only those employees hired prior to the date entered.


*********************************************************

Je remecie tous ceux qui font avancer le Chmilblic....

3 réponses

toysf Messages postés 19 Date d'inscription lundi 26 mai 2003 Statut Membre Dernière intervention 21 juillet 2005
8 juil. 2005 à 14:01
Merci Beaucoup
Ca fait 4 jours que j'ai ce probleme
Merci encore
0
toysf Messages postés 19 Date d'inscription lundi 26 mai 2003 Statut Membre Dernière intervention 21 juillet 2005
8 juil. 2005 à 14:03
J'ai un autre probleme :
Je veux changer la valeur d'une etiquette dans un datareport par code
Merci d'avance
0
MAOUHOUB1980 Messages postés 1 Date d'inscription samedi 11 février 2012 Statut Membre Dernière intervention 16 février 2012
16 févr. 2012 à 18:49
mersi bien pour la solution
0
Rejoignez-nous