Why doesn't this work!!!...

  • Thread starter Thread starter Brett Davis
  • Start date Start date
B

Brett Davis

Hello...

I am using Access 2003 and I am attempting to run this from a command
button:
CommandBars("Menu Bar").Controls("File").Controls("Page
Setup...").Execute

When I try to run this... I get this error message:

This action can't be carried out while processing a form or report event.
A macro specified as the OnOpen, OnClose, OnFormat, OnRetreat, OnPage, or
OnPrint property setting contains an invalid action for the property.

When I execute this:
CommandBars("Menu Bar").Controls("File").Controls("New...").Execute
or this:
CommandBars("Menu Bar").Controls("File").Controls("Close").Execute

It works!!!

I have the references set to Microsoft Office 12.0 Object Library. I have
also tried it with Microsoft Office 11.0 Object Library as well... the
command fails on both...

Please advise...

Thanks,

Brett
 
As far as I'm aware, Page Setup can only be invoked when the report is open
in Design view. Is that your case?
 
Back
Top