I import a file into Access which has 2 columns:
Serial and Date
This file has serials from many previous dates. A Serial can appear multiple times in the serial column but only once on a particular date.
The object of my investigation is to find those serials that appear in the last three read dates.
Reads are done on any three days Mon-Fri. Not necessarily on consecutive days. And often not in the same week.
I have written a VBA module that calls a query to spit out this data. Here's the SQL code for the query:
Code:
SELECT Serial
FROM 3days
WHERE date>=#12/4/2013#
GROUP BY Serial
HAVING count(*)=3;
As you can see, I am currently hard coding the date. I would like to have my SQL code do this:
SORT DISTINCT on Date descending
Note the third date from the top as a variable
Pass this variable into the SQL query in the where clause.
But my SQL isn't strong enough to do this.
I am grateful for any suggestions on how to do this.