Monday, December 29, 2014

Microsoft Access query - Criteria default to all or filter on choice

I have an Access database with a report that uses a query.   I need the query to prompt for a certain criteria (division name) so I can print out only the report for that division, -or- if, I need the entire set of data in the report, it will default to all the data.




I wanted to keep it simple without VB code, so in the Criteria: I used:


Like "*" & [What division?]
1) when I put data into the prompt, the query only returns the data that matches my entry
2) if I put nothing (null), then it returns the entire set.


I couldn't find anything that easy on line, but some trial and error paid off.
Hope this helps someone.


-Reg