David,
You may have missed this from Marsh's first post, but the code
he provided *must* be in the form that opens the report. This code
cannot be put in the report's Open event which it appears you
are doing. Move the code to the form that opens the report, such
as a command button's Click event.
--
Jeff Conrad
Access Junkie - MVP
http://home.bendbroadband.com/conradsystems/accessjunkie.html
http://www.access.qbuilt.com/html/articles.html
in message:
Marsh,
Just tried your last suggestion. Got the same error again. ????
BTW, where can I find a definition of the constants you are referring to?
Thanks for your help.
Dave
Marshall Barton said:
I had the wrong fit thingie. Try this:
DoCmd.OpenReport . . .
DoCmd.Maximize
DoCmd.RunCommand acCmdFitToWindow
--
Marsh
MVP [MS Access]
David Semon wrote:
Just tried your suggested code. Got an error message: 2046, "The command
or action "SizeToFit" isn't available now.
When I go to the debugger, the DoCmd.RunCommand acCmdSizeToFit line is
highlighted.
I want to open a report preview from a command button on a form and have the
report preview window maximize and the report fit the window. I can't
remember the way to fit the rport.