Alex Alex - 4 months ago 24
SQL Question

Access 2016 automatically run report with criteria prompt?

I'm working on an Access 2016 database for logging pass/fail conditions in my factory. I have everything I need if I want to run everything manually, now I want to automate my database.

I've got a report that pulls data from a query. When I run the report, the query's criteria prompt is triggered, asking for the date in mm/dd/yyyy format. Manually entering in the info works fine, but how can I create a macro that automatically puts a value into the prompt for me?

I've tried using the Macro design tool to "OpenReport" with the following Where Condition line:

Where Condition =

[DailyReport Query]![LogDate] = Date()


However, when I run the macro, I still get the prompt to enter in the date. Am I missing something incredibly simple here? I'm still searching for the answer so, if I find it, I'll post it. Any and all help in the meantime is greatly appreciated!

Answer

Instead, put Date() in the query criteria field under Log Date instead of putting it in the macro.