Function Works From Cmd Btn But Not From Right Click

J

JamesJ

The following code works ok from a command button but when I place it in a
macro
for the shortcut menu it tells me that

Runtime error 2174
'You can't switch to a different view at this time.'

Function FormLayoutView()

Dim fm As Form
Set fm = Screen.ActiveForm

DoCmd.OpenForm fm.Name, acLayout

End Function

If I click the close button on the error box I'm then presented with
the default shortcut menu. When I click Design View the form switches to
design view.
I thought I couldn't switch to a different view!!!
The same macro command (different macro) works fine for one form.
I even changed macros to the one that "seems to work" and same thing occurs.
It seems access is trying to run the first Macro Name in the Macro instead
of just presenting me
with the shortcut menu.

I have several issues with access 2007 sp2 that I'm not sure if they're bugs
or not. But I can't seem
to make any damn headway with my db app. Every time I try something
something else pops up.
I've already switched all my forms over to continuous form from split forms
because certain
things doesn't work properly with split forms but work fine with contiguous
forms.
An yes, I have already many times, been to Allen Browne's fine web site to
look at the issues for
access 2007 but don't seem to find my issues.
Granted I'm not a programmer or developer by any stretch of the imagination
but for all the money
I spent purchasing MS Access one would think these items would be fixed (if
they are bugs)

Thanks,
James
 
J

JamesJ

I was calling the wrong macro. I was setting the macro with the items
not the one with the AddMenu.
But anyone who read my little tirade, thanks.

James
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top