Bonjour,

J'essaie en vain de créer une requete sous vba access mais en vain .
J'ai un message d'erreur 3141 "dans l instruction select, un mot reservé ou un argument est mal orthographié, ou absent, ou la ponctuation est incorrecte"

Je vous joins ci dessous la requete

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
Private Sub trafic_matin()
 
    Liste_nbre_colis_triés_matin.Value = 0 'initialisation de la liste box trafic matin
 
    Dim rst1 As DAO.Recordset
    Dim str1 As String
   str1 = ""
 
str1 = "SELECT Count(dbo_vwItemData.ItemID) AS [nbre net de colis traités], CVDate(Fix(([DischargeEventTime]-(5/24)))) AS jour"
 
str1 = str1 & "FROM (dbo_vwItemData INNER JOIN dbo_vwParts ON dbo_vwItemData.DischargePartID = dbo_vwParts.ID) INNER JOIN [table_Affich-general] ON dbo_vwParts.DisplayName = [table_Affich-general].[Chute (format access)]"
 
str1 = str1 & "WHERE ((([table_Affich-general].Type) <> RJT & ((dbo_vwItemData.DischargeEventTime) >= (CVDate(Fix(Now() - (5 / 24))) + (5 / 24)) And (dbo_vwItemData.DischargeEventTime) <= (CVDate(Fix(Now() - (5 / 24))) + ((25 / 2) / 24))))"
 
str1 = str1 & "GROUP BY CVDate(Fix(([DischargeEventTime]-(5/24))))"
 
str1 = str1 & "ORDER BY Count(dbo_vwItemData.ItemID) DESC;"
 
 
    Set rst1 = CurrentDb.OpenRecordset(str1, dbOpenDynaset)
    txt_trafic_matin.Value = rst1(0)
    rst1.Close
    Set rst1 = Nothing
 
End Sub