Nick Meyer said:
I have run across this bug in AC '97 ,2000, and 2003. Does anybody
know how to fix it?
Build a throwaway form, report or query. Close it. The save as
dialog occurs. THE CANCEL BUTTON HAS NO EFFECT --grrr!
It is supposed to close the object discarding changes--since it was a
new object, nothing should be saved.
Instead nothing happens. The object must be saved and then deleted
from the database window. My Access 2003 was good for about 6 weeks
before this happened.
Anybody know how to fix this?
It took me a minute, but I think now I know what you're talking about.
The key realization is that there is a dialog you are not seeing, that
should come before the Save As dialog. There is a warning message that
you should normally get first; it will say something like
Do you want to save changes to the design of <object type> <object
name>?
with buttons Yes, No, and Cancel. In this dialog, clicking Yes brings
up the Save As dialog, if it's a new object, while clicking No closes it
without saving, and Cancel keeps the object open.
If you click Yes, so that the Save As dialog is displayed, then clicking
Cancel in that dialog is *not* "supposed to close the object discarding
changes", as you think. Instead, it's supposed to cancel the close, and
that's what it does.
Now, by this point you're saying, :"If Dirk isn't full of hooey, why am
I not seeing this warning message he's talking about?" My guess is
that, somewhere in your database, you have a VBA statement
DoCmd.SetWarnings False
that isn't balanced by a corresponding
DoCmd.SetWarnings True
Note that you may have the statements paired like this:
DoCmd.SetWarnings False
' ... code between ...
DoCmd.SetWarnings True
and you could still end up with warnings turned off, if an error occurs
in the "code between" that prevents the warnings from being turned back
on. That's why the SetWarnings method must be used sparingly and with
good error-handling in place to ensure that there is no way to get out
of the procedure without turning warnings back on again.
When warnings are turned off, that warning dialog isn't displayed, and
the default button for the dialog is assumed to have been clicked. In
this case, that would be the Yes button. So, with warnings turned off,
you get the behavior you describe.
You can try this out, by the way. Create a new object as you described,
and then -- before trying to close it -- press Ctrl+G to open the
Immediate Window, and in that window enter the line
DoCmd.SetWarnings True
I'll bet you see the warning dialog.
I haven't heard of any bug that causes the warnings setting to be
ignored or permanently set off, so I'm guessing that this is something
your own code is doing.