ItIsHardToProgram
Technical User
As I have been suggested, I am posting my problem in a more appropriate forum.
I am trying to use the between clause with dates in a VBA generated SQL. I have the following code wich errors on the DoCmD.
Thank you!
"Knowing that you know is the greatest sign of stupidity, knowing that you are ignorant is the best proof of intelligence.
I am trying to use the between clause with dates in a VBA generated SQL. I have the following code wich errors on the DoCmD.
Code:
Option Compare Database
Dim dDateBEG As Date
Dim dDateEND As Date
Private Sub DateBEG_AfterUpdate()
dDateBEG = DateBEG.Value
End Sub
Private Sub DateEND_AfterUpdate()
dDateEND = DateEnd.Value
End Sub
Private Sub Creer_Click()
Dim strSQL As String
MsgBox (dDateBEG)
MsgBox (dDateEND)
strSQL = "SELECT T.IdProjet, T.IDEmployer , SUM(T.LundiRD+T.MardiRD+T.MercrediRD+T.JeudiRD+T.VendrediRD+T.SamediRD+T.DimancheRD)" & _
"AS [Heures de R&D], T.semaine"
strSQL = strSQL + " FROM tblTimeSheet AS T " & _
" WHERE T.semaine BETWEEN #" & dDateBEG & "# AND #" & dDateEND & _
"# GROUP BY T.IdProjet;"
DoCmd.OpenQuery (strSQL)
'DoCmd.SetWarnings True
End Sub
Thank you!
"Knowing that you know is the greatest sign of stupidity, knowing that you are ignorant is the best proof of intelligence.