P
Paul
Hello there,
I have two query's; one to get totals for pallets received on Mondays
and the other to get the average from the the first query...
Query one - Week Day Totals - SQL VIEW
SELECT RecyHistory.DateRec, Sum(RecyHistory.PalletCount) AS SumOfPalletCount
FROM RecyHistory
GROUP BY RecyHistory.DateRec
HAVING (((DatePart("w",[RecyHistory].[DateRec]))=DatePart("w",2)));
Query 2 - Averages - SQL VIEW
SELECT DISTINCTROW Avg([Day total].SumOfPalletCount) AS [Avg Of
SumOfPalletCount], Count(*) AS [Count Of qrytest]
FROM [Day total];
I think there must be an easier solution with code to get the pallet count
for every Monday ( and T,W,TH,F as well) and the average
pallet count ( for each weekday) and place that code within the form and
eliminate the query's altogether, but what would be the easiest way?
I have a form with text boxes for each week day - total and average.
This is my attempt so far...but I get an error with the last line.
Week Day DAO test......
Private Sub DateRec_GotFocus()
Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef
Dim strsql As String
Set dbs = CurrentDb
strsql = "SELECT RecyHistory.DateRec, Sum(RecyHistory.PalletCount) AS
SumOfPalletCount" _
& "FROM RecyHistory GROUP BY RecyHistory.DateRec" _
& "HAVING #" & DatePart("w", RecyHistory.DateRec) = DatePart("w", 2) & "# ;"
End Sub
Any advise would be greatly appreciated.
Thank you,
Paul
I have two query's; one to get totals for pallets received on Mondays
and the other to get the average from the the first query...
Query one - Week Day Totals - SQL VIEW
SELECT RecyHistory.DateRec, Sum(RecyHistory.PalletCount) AS SumOfPalletCount
FROM RecyHistory
GROUP BY RecyHistory.DateRec
HAVING (((DatePart("w",[RecyHistory].[DateRec]))=DatePart("w",2)));
Query 2 - Averages - SQL VIEW
SELECT DISTINCTROW Avg([Day total].SumOfPalletCount) AS [Avg Of
SumOfPalletCount], Count(*) AS [Count Of qrytest]
FROM [Day total];
I think there must be an easier solution with code to get the pallet count
for every Monday ( and T,W,TH,F as well) and the average
pallet count ( for each weekday) and place that code within the form and
eliminate the query's altogether, but what would be the easiest way?
I have a form with text boxes for each week day - total and average.
This is my attempt so far...but I get an error with the last line.
Week Day DAO test......
Private Sub DateRec_GotFocus()
Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef
Dim strsql As String
Set dbs = CurrentDb
strsql = "SELECT RecyHistory.DateRec, Sum(RecyHistory.PalletCount) AS
SumOfPalletCount" _
& "FROM RecyHistory GROUP BY RecyHistory.DateRec" _
& "HAVING #" & DatePart("w", RecyHistory.DateRec) = DatePart("w", 2) & "# ;"
End Sub
Any advise would be greatly appreciated.
Thank you,
Paul