you should use:
WHERE [JobTransDate]
BETWEEN DateSerial([Enter Year:], [Enter Month:], 1)
AND DateSerial([Enter Year:], [Enter Month:] + 1, 0)
You are close but not quite there. For example:
CREATE TABLE TestDates (
key_col INTEGER NOT NULL PRIMARY KEY,
data_col DATETIME NOT NULL
)
;
INSERT INTO TestDates VALUES (1, #2005-03-31#);
INSERT INTO TestDates VALUES (2, #2005-03-31 06:00:00#);
INSERT INTO TestDates VALUES (3, #2005-03-31 18:00:00#);
INSERT INTO TestDates VALUES (4, #2005-04-01#);
INSERT INTO TestDates VALUES (5, #2005-04-01 06:00:00#);
INSERT INTO TestDates VALUES (6, #2005-04-01 18:00:00#);
INSERT INTO TestDates VALUES (7, #2005-04-30#);
INSERT INTO TestDates VALUES (8, #2005-04-30 06:00:00#);
INSERT INTO TestDates VALUES (9, #2005-04-30 18:00:00#);
INSERT INTO TestDates VALUES (10, #2005-05-01#);
INSERT INTO TestDates VALUES (11, #2005-05-01 06:00:00#);
INSERT INTO TestDates VALUES (12, #2005-05-01 18:00:00#);
I think it's clear the intention is to SELECT all rows for April 2005,
being rows 4 to 9 inclusive.
Your approach:
SELECT key_col, data_col
FROM TestDates
WHERE data_col BETWEEN DateSerial(2005, 04, 1)
AND DateSerial(2005, 04 + 1, 0);
will only SELECT rows 4 to 7.
For a full solution, I prefer to use Jet's DATEDIFF function:
SELECT key_col, data_col
FROM TestDates
WHERE DATEDIFF('d', DateSerial(2005, 4, 1), data_col) >= 0
AND DATEDIFF('d', DateSerial(2005, 4 + 1, 0), data_col) <= 0;
Jamie.