R
ryguy7272
I’m calculating average returns for stocks over two time periods; 30-days and
90-days. These two queries always return the same results for different time
periods and I have no idea why.
PARAMETERS [Forms]![frmMstr]![cboEnd] DateTime;
SELECT Avg(SharePrices.StockPrice) AS AvgStockPrice30_Days,
SharePrices.StockSymbol
FROM tblStocksGroup INNER JOIN SharePrices ON tblStocksGroup.Ticker =
SharePrices.StockSymbol
WHERE
(((SharePrices.DateTime)>=DateAdd("d",-21*(365/250),[Forms]![frmMstr]![cboEnd])))
GROUP BY SharePrices.StockSymbol;
PARAMETERS [Forms]![frmMstr]![cboEnd] DateTime;
SELECT Avg(SharePrices.StockPrice) AS AvgStockPrice90_Days,
SharePrices.StockSymbol
FROM tblStocksGroup INNER JOIN SharePrices ON tblStocksGroup.Ticker =
SharePrices.StockSymbol
WHERE
(((SharePrices.DateTime)>=DateAdd("d",-63*(365/250),[Forms]![frmMstr]![cboEnd])))
GROUP BY SharePrices.StockSymbol;
I copied the date from the Access table where it is stored, pasted it into
Excel, created a pivot table and it calculates fine, but in Access it’s not
calculating correctly. Can someone please tell me what I’m doing wrong?
Thanks!
Ryan--
90-days. These two queries always return the same results for different time
periods and I have no idea why.
PARAMETERS [Forms]![frmMstr]![cboEnd] DateTime;
SELECT Avg(SharePrices.StockPrice) AS AvgStockPrice30_Days,
SharePrices.StockSymbol
FROM tblStocksGroup INNER JOIN SharePrices ON tblStocksGroup.Ticker =
SharePrices.StockSymbol
WHERE
(((SharePrices.DateTime)>=DateAdd("d",-21*(365/250),[Forms]![frmMstr]![cboEnd])))
GROUP BY SharePrices.StockSymbol;
PARAMETERS [Forms]![frmMstr]![cboEnd] DateTime;
SELECT Avg(SharePrices.StockPrice) AS AvgStockPrice90_Days,
SharePrices.StockSymbol
FROM tblStocksGroup INNER JOIN SharePrices ON tblStocksGroup.Ticker =
SharePrices.StockSymbol
WHERE
(((SharePrices.DateTime)>=DateAdd("d",-63*(365/250),[Forms]![frmMstr]![cboEnd])))
GROUP BY SharePrices.StockSymbol;
I copied the date from the Access table where it is stored, pasted it into
Excel, created a pivot table and it calculates fine, but in Access it’s not
calculating correctly. Can someone please tell me what I’m doing wrong?
Thanks!
Ryan--