I would take a look at your SQL statement. Set a breakpoint at the rs.Open line and take a look to make sure that your SQL statement looks exactly the way you think it should. SQL is extremely picky in how the line is parsed.
For example,
Part of the string would read "#01/01/2012 # AND RecDate <= # 01/12/2012 #" You have a space between the # and the date everywhere but the very first pound sign. That might cause an issue.
You also might want to block your date selection in () and then AND document
SELECT * FROM tbl WHERE(RecDate >= #D1# AND recDate <= #D2#) AND document = 'a'
I think there is a buit in SQL statement BETWEEN D1 and D2 but you would need to test that because sometimes BETWEEN returns differently from providers. I don't know how JET does it. I use BETWEEN quite a bit but I also have a time stamp so when I say BETWEEN 01/09/2012 and 01/10/2012 there are a bunch of records from 12 to 12.
Of course this might all be pedantic nonsense and not help you. I have in the past durring debug taken the SQL statment and pasted it into Access' query builder and debuged it from there when I have gotten stuck.
Bookmarks