By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,578 Members | 828 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,578 IT Pros & Developers. It's quick & easy.

How to avoid default "can't save form at this time" message?

P: n/a
I have non-computer skilled users entering data into a form. There
are certain ranges of values which, if they enter them, make no sense
in the application, but I can't test them until they try to close out
the form, in which case I can look at the entire set of values and see
if they're OK. So, I have this code.

for the "Before Update" event:

if (their variables are inappropriate) then
msgbox "You've entered bad variables (or some such message),
go back and fix them", vbexclamation
cancel = true
end if
end sub

This works fine, except that the user gets the following message
(which I want suppressed):
"You can't change the record at this time. If you close this object
now, all the data changes you have made will be lost. Do you want to
close the databases object anyway?"
YES NO
The default is "yes," which I don't want them to get.
I don't want them to get this message, because it happens rarely and
the users don't understand it. I just want my "cancel=true" statement
to kill the update process and return them to the form, without any
further word from Bill Gates. How do I do that?
Thanks. Pete Brady
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Pete

If you have users who find this message mildly annoying, ask them whether
they would prefer Access to just silently lose their entry without telling
them. Microsoft is giving them the choice: they can go back and fix the
entry, or throw the entry away and get out of there. That's a pretty useful
choice.

They only get that choice if they try to close the form when it contains an
unsavable entry. You can try to work around that by disabling the Close
button on the form, building a custom menu so they can't choose Close from
the File menu or switch views from the View menu, or apply a filter or sort
from the Records menu, apply a custom toolbar to remove all the problem
buttons, reprogram the keystrokes such as Ctrl+F4 and Alt+F4 with an
AutoKeys macros, and run API calls to remove the close button from the main
Access window.

Or you could programmatically set module-level flags that let you cancel the
UnLoad event of the form and generate even more annoying message boxes and
end up corrupting the database as frustrated users who can't get out of
their form terminate Access with the Windows Task Manager or by switching
off their database.

Or, you could add a Cancel button to your form to give them another way out:
If Me.Dirty Then Me.Undo
DoCmd.Close acForm, Me.Name

BTW, there is a serious bug with the Close action that *does* cause it to
silently lose what the user entered if it cannot be saved:
http://allenbrowne.com/bug-01.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Paul Brady" <pt*****@aol.com> wrote in message
news:2c********************************@4ax.com...
I have non-computer skilled users entering data into a form. There
are certain ranges of values which, if they enter them, make no sense
in the application, but I can't test them until they try to close out
the form, in which case I can look at the entire set of values and see
if they're OK. So, I have this code.

for the "Before Update" event:

if (their variables are inappropriate) then
msgbox "You've entered bad variables (or some such message),
go back and fix them", vbexclamation
cancel = true
end if
end sub

This works fine, except that the user gets the following message
(which I want suppressed):
"You can't change the record at this time. If you close this object
now, all the data changes you have made will be lost. Do you want to
close the databases object anyway?"
YES NO
The default is "yes," which I don't want them to get.
I don't want them to get this message, because it happens rarely and
the users don't understand it. I just want my "cancel=true" statement
to kill the update process and return them to the form, without any
further word from Bill Gates. How do I do that?
Thanks. Pete Brady

Nov 13 '05 #2

P: n/a
On Fri, 22 Jul 2005 09:51:37 +0800, "Allen Browne"
<Al*********@SeeSig.Invalid> wrote:
Hi Pete

If you have users who find this message mildly annoying, ask them whether
they would prefer Access to just silently lose their entry without telling
them. Microsoft is giving them the choice: they can go back and fix the
entry, or throw the entry away and get out of there. That's a pretty useful
choice.


Allen, Thanks for your reply. I know you realize this, but my users
don't find the message "mildly annoying," but rather, completely
mystifying, and they get blown away when they see some of the weird
and convoluted messages Microsoft produces. So, in this case I myself
gave them the choice to save their "bad" variables or go back, and
this choice worked well, except that the Microsoft message now comes
in on top of my more "friendly" message. I guess we will just have to
live with it. Maybe I should print a message that says something
like,
"You IDIOT! You can't have someone's birthdate later than today's
date!" (Incidentally, I catch that one right away when the leave the
Birthdate control field, well before they try to close out the form.)

I have printed your reply and will see if I can manage to live with
the way things are. Thanks. Pete
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.