C
chuck
I have a report which is generated from data in a form. If the report is
opened directly, without going through the form, some values will be missing
from the report. To prevent this, I want to add some code which will be
executed with the report's On Open event. Essentially, if the report is
opened from a form, then open the report. If the report is opened from the
Reports window in Access, then a message is displayed and the report should
close.
Sounds simple enough except I always get this error message when the code
tries to close the report:
"Run-time error '2585': This action can't be carried out while processing a
form or report event".
I tried closing the report with " DoCmd.Close acReport 'myReport' " and "
DoCmd.RunCommand acCmdClose " but these both give the same error.
Any ideas on how I can close the report?
Thanks
opened directly, without going through the form, some values will be missing
from the report. To prevent this, I want to add some code which will be
executed with the report's On Open event. Essentially, if the report is
opened from a form, then open the report. If the report is opened from the
Reports window in Access, then a message is displayed and the report should
close.
Sounds simple enough except I always get this error message when the code
tries to close the report:
"Run-time error '2585': This action can't be carried out while processing a
form or report event".
I tried closing the report with " DoCmd.Close acReport 'myReport' " and "
DoCmd.RunCommand acCmdClose " but these both give the same error.
Any ideas on how I can close the report?
Thanks