Rerun report from command button? (1 Viewer)

miamiTed

New member
Local time
Today, 04:56
Joined
Jul 10, 2012
Messages
4
I am still new to Access, using 2007.

I have a report that prompts for claim number and displays that record. It works great.

I have a command button that I would like to re-run the report with a different claim number instead of the user having to close the report and reopen it. I have created a macro using the OpenReport action, which works when I run the macro, I get a prompt for the claim number and then the report opens with the correct claim information.

I assinged the macro to On Click event, but when I click the button in the report, it does not do anything.
 
Last edited:
Try this:
On the click event on the report in vb put

Docmd.Close
'put the code from the button that works here'



That should close the report and then run the query with the prompt and open the report again,
 
You can make it look like it isn't closing (you still have to close) by using this code in your button's click event:

Code:
Application.Echo False
 
DoCmd.Close acReport, "ReportNameHere", acSaveNo
DoCmd.OpenReport "ReportNameHere", WhereCondition:="YourWhereClauseHere"
 
Application.Echo True
 
Thanks. I have a macro assigned to the button. I added close as the first line and it works.
 

Users who are viewing this thread

Back
Top Bottom