Adodc sur vb

cs_caio Messages postés 2 Date d'inscription mercredi 7 juin 2006 Statut Membre Dernière intervention 14 juin 2006 - 7 juin 2006 à 09:37
cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 - 7 juin 2006 à 10:28
probleme de requte sur mon ADODC

code source :
Public Function reporting_option()
    'On Error Resume Next



    If Option1.Value = True Then
        sql = "SELECT Sum(CommandeLigne.MontantHT_E) AS SommeDeMontantHT_E, CompteGeneralEtAnalytique.CompteAnalytiqueFR " & _                "FROM ((Commande INNER JOIN CommandeLigne ON Commande.NoCommande CommandeLigne.NoCommande) INNER JOIN Article ON CommandeLigne.CodeArticle Article.CodeArticle) INNER JOIN CompteGeneralEtAnalytique ON Article.NoFamille = CompteGeneralEtAnalytique.Reference " & _
                "Where (((Commande.Etat) <= 3) And ((Commande.DateCreation) <= #" & dates & "#) And ((Commande.Type) > 0)) " & _
                "GROUP BY CompteGeneralEtAnalytique.CompteAnalytiqueFR;"
        tbl = "ReportingBackLog"
    End If
    If Option2.Value = True Then
        sql = "SELECT Sum(CommandeLigne.MontantHT_E) AS SommeDeMontantHT_E, CompteGeneralEtAnalytique.CompteAnalytiqueFR " & _                "FROM ((Commande INNER JOIN CommandeLigne ON Commande.NoCommande CommandeLigne.NoCommande) INNER JOIN Article ON CommandeLigne.CodeArticle Article.CodeArticle) INNER JOIN CompteGeneralEtAnalytique ON Article.NoFamille = CompteGeneralEtAnalytique.Reference " & _
                "Where (((Commande.Etat) <= 3) And ((Commande.DateCreation) >= #" & dates & "#) And ((Commande.Type) > 0)) " & _
                "GROUP BY CompteGeneralEtAnalytique.CompteAnalytiqueFR;"
        tbl = "ReportingOrders"
    End If
    If Option3.Value = True Then
        sql = "SELECT Sum(FactureLigne.MontantHT_E) AS SommeDeMontantHT_E, CompteGeneralEtAnalytique.CompteAnalytiqueFR " & _                "FROM ((Facture INNER JOIN FactureLigne ON Facture.NoFacture FactureLigne.NoFacture) INNER JOIN Article ON FactureLigne.CodeArticle Article.CodeArticle) INNER JOIN CompteGeneralEtAnalytique ON Article.NoFamille = CompteGeneralEtAnalytique.Reference " & _
                "Where (((Facture.DateFacture) >= #" & dates & "#) And ((Facture.NoFacture) >= " & Chr(34) & "FM05000000" & Chr(34) & " And (Facture.NoFacture) <= " & Chr(34) & "PM05000000" & Chr(34) & ")) " & _
                "GROUP BY CompteGeneralEtAnalytique.CompteAnalytiqueFR;"
        tbl = "ReportingSales"
    End If
    If Option4.Value = True Then
        sql = "SELECT Commande.Type, Commande.NoClient, Commande.Nom, Commande.Etat, CommandeLigne.MontantHT_E, Commande.DateCreation, Client.NoSecteurAct " & _                "FROM (Commande INNER JOIN CommandeLigne ON Commande.NoCommande CommandeLigne.NoCommande) INNER JOIN Client ON Commande.NoClient Client.NoClient " & _
                "WHERE (((Commande.Type)>0) AND ((Commande.Etat)<3) AND ((Commande.DateCreation)<=#" & dates & "#) AND ((Client.NoSecteurAct)=" & Chr(34) & "002" & Chr(34) & "));"
        tbl = "ReportingBackLogGroupe"
    End If
    If Option5.Value = True Then
        sql = "SELECT Commande.Type, Commande.NoClient, Commande.Nom, Commande.Etat, CommandeLigne.MontantHT_E, Commande.DateCreation, Client.NoSecteurAct " & _                "FROM (Commande INNER JOIN CommandeLigne ON Commande.NoCommande CommandeLigne.NoCommande) INNER JOIN Client ON Commande.NoClient Client.NoClient " & _
                "WHERE (((Commande.Type)>0) AND ((Commande.Etat)<3) AND ((Commande.DateCreation)>=#" & dates & "#) AND ((Client.NoSecteurAct)=" & Chr(34) & "002" & Chr(34) & "));"
        tbl = "ReportingOrdersGroupe"
    End If
    If Option6.Value = True Then
        sql = "SELECT DISTINCTROW Facture.NoClient, Facture.Nom, FactureLigne.CompteAnalytique, FactureLigne.CompteGeneral, Sum(FactureLigne.MontantHT_E) AS SommeDeMontantHT_E, Facture.DateFacture " & _                "FROM (Facture INNER JOIN Client ON Facture.NoClient Client.NoClient) INNER JOIN FactureLigne ON Facture.NoFacture FactureLigne.NoFacture " & _
                "Where (((Facture.NoFacture) >= " & Chr(34) & "FM050000" & Chr(34) & " And (Facture.NoFacture) < " & Chr(34) & "PM050000" & Chr(34) & ") And ((Facture.DateFacture) >= #" & dates & "#)) " & _
                "GROUP BY Facture.NoClient, Facture.Nom, FactureLigne.CompteAnalytique, FactureLigne.CompteGeneral, Facture.DateFacture, Client.NoSecteurAct " & _
                "HAVING (((Client.NoSecteurAct)=" & Chr(34) & "002" & Chr(34) & "));"
        tbl = "ReportingSalesGroupe"
    End If
   
    Adodc1.CommandType = adCmdText
    Adodc1.RecordSource = sql
    Adodc1.Refresh
   
End Function


un message apparait lors de l'execution disant :

click debug : erreur sur la method refresh
?

1 réponse

cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 130
7 juin 2006 à 10:28
Avant de poster dans le forum,
prière d'aller lire ceci :
http://www.codes-sources.com/reglement.aspx


<s>
</s>
0
Rejoignez-nous