Salut,
ma base Access est liée à VB6 via ADO.
je veux afficher la synthèse des totaux grouper par mois et années.
voici mon code

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
 
Connection
'********************************************************
' Caculer Seulement la somme des les valeurs du champ [total_ttc]_
' dont la valeur du champ [etat] est "Réglé"
'********************************************************
Adodc1.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" + App.Path + "\unib_gestion.mdb;persist security info=false"
SQL = "SELECT sum([total_ttc]) as total,Year(date_facture)as ann, Month (date_facture)as moi" & _
         "  From facture where etat='Réglé'" & _
         " GROUP By month([date_facture]), year([date_facture])"
         Adodc1.RecordSource [COLOR="SeaGreen"]= SQL
Adodc1.Refresh
Set DRsynt.DataSource = Adodc1


'*******************************************************
' Caculer la somme de toutes les valeurs du champ [reste]
'*******************************************************
Adodc1.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" + App.Path + "\unib_gestion.mdb;persist security info=false"
SQL = "SELECT sum([reste]) as rest,Year(date_facture)as ann, Month (date_facture)as moi" & _
         "  From facture" & _
         " GROUP By month([date_facture]), year([date_facture])"
         Adodc1.RecordSource = SQL
Adodc1.Refresh
Set DRsynt.DataSource = Adodc1
    
DRsynt.Show
N.B: le problème est qu'un message d'erreur s'affiche ( "Datafield 'total' not found") alors que j'ai désigné les datafields des textbox dans DataReport( total et rest)
Merci.