J
John T Ingato
I have included the SQL below:
This is a total query that calculates total dollars sold out of each of the
1800 stores. As some of the stores have just opened, I have calculated the
number of weeks reported using ([LastReportingDate]-[FirstReportingDate])/7
AS WeeksReported.
On the last line of the select clause I have ...
Format(Sum([DollarsSold])/[WeeksReported],"Currency") AS DollarsPerWeek ...
which divides the DollarsSold / WeeksReported then formated the expression
as currency. If try to sort ascending, I get a dialog asking for
WeeksReported. If I don't sort ascending and sort the recordset instead, it
sort the fields as string values:
2
21
22
3
34
Is there a way to force that expression to become a number instead of a
string? In the data set, the fields are left justified, so I know they are
strings.
********SQL*****************
SELECT
tblHomeDepotCalculatedSalesData.StoreNumber,
tblHomeDepotStoreList.City,
tblHomeDepotStoreList.State,
tblHomeDepotStoreList.MKT,
Min(tblHomeDepotCalculatedSalesData.FromDate) AS FirstReportingDate,
Max(tblHomeDepotCalculatedSalesData.ToDate) AS LastReportingDate,
([LastReportingDate]-[FirstReportingDate])/7 AS WeeksReported,
Sum(tblHomeDepotCalculatedSalesData.DollarsSold) AS SumOfDollarsSold,
Format(Sum([DollarsSold])/[WeeksReported],"Currency") AS DollarsPerWeek
FROM
tblMLOProductLine INNER JOIN (tblHomeDepotStoreList INNER JOIN
tblHomeDepotCalculatedSalesData
ON tblHomeDepotStoreList.StoreNumber =
tblHomeDepotCalculatedSalesData.StoreNumber)
ON tblMLOProductLine.ItemNumber = tblHomeDepotCalculatedSalesData.ItemNumber
GROUP BY tblHomeDepotCalculatedSalesData.StoreNumber,
tblHomeDepotStoreList.City, tblHomeDepotStoreList.State,
tblHomeDepotStoreList.MKT;
This is a total query that calculates total dollars sold out of each of the
1800 stores. As some of the stores have just opened, I have calculated the
number of weeks reported using ([LastReportingDate]-[FirstReportingDate])/7
AS WeeksReported.
On the last line of the select clause I have ...
Format(Sum([DollarsSold])/[WeeksReported],"Currency") AS DollarsPerWeek ...
which divides the DollarsSold / WeeksReported then formated the expression
as currency. If try to sort ascending, I get a dialog asking for
WeeksReported. If I don't sort ascending and sort the recordset instead, it
sort the fields as string values:
2
21
22
3
34
Is there a way to force that expression to become a number instead of a
string? In the data set, the fields are left justified, so I know they are
strings.
********SQL*****************
SELECT
tblHomeDepotCalculatedSalesData.StoreNumber,
tblHomeDepotStoreList.City,
tblHomeDepotStoreList.State,
tblHomeDepotStoreList.MKT,
Min(tblHomeDepotCalculatedSalesData.FromDate) AS FirstReportingDate,
Max(tblHomeDepotCalculatedSalesData.ToDate) AS LastReportingDate,
([LastReportingDate]-[FirstReportingDate])/7 AS WeeksReported,
Sum(tblHomeDepotCalculatedSalesData.DollarsSold) AS SumOfDollarsSold,
Format(Sum([DollarsSold])/[WeeksReported],"Currency") AS DollarsPerWeek
FROM
tblMLOProductLine INNER JOIN (tblHomeDepotStoreList INNER JOIN
tblHomeDepotCalculatedSalesData
ON tblHomeDepotStoreList.StoreNumber =
tblHomeDepotCalculatedSalesData.StoreNumber)
ON tblMLOProductLine.ItemNumber = tblHomeDepotCalculatedSalesData.ItemNumber
GROUP BY tblHomeDepotCalculatedSalesData.StoreNumber,
tblHomeDepotStoreList.City, tblHomeDepotStoreList.State,
tblHomeDepotStoreList.MKT;