Best way to facilitate user's cancel?

L

LAS

Since Access doesn't require an explicity save when records are created or
modified in a form, what is the best way to allow the user to undo what they
have done before leaving a record?

tia
las
 
J

John W. Vinson

Since Access doesn't require an explicity save when records are created or
modified in a form, what is the best way to allow the user to undo what they
have done before leaving a record?

tia
las

1. Teach them that hitting <Esc> twice will cancel the edit.
2. Put a command button on the form which executes a Me.Undo action.
3. (worst choice IMO since users will just click OK anyway) Put code in the
Form's BeforeUpdate event to make them verify that they want to save:

Private Sub Form_BeforeUpdate(Cancel as Integer)
Dim iAns As Integer
iAns = MsgBox("Okay to save?", vbOkCancel)
If iAns = vbCancel Then
Cancel = True
Me.Undo
End If
End Sub
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
M

ManningFan

I always get flamed by a few ... ahem... "MVPs" when I say this, but
an unbound form with an "Update" button is the easiest way. The
record isn't saved until the user clicks the Update button, so even if
they just close the screen it's not going to cause problems.
 
A

Access Developer

ManningFan said:
I always get flamed by a few ... ahem... "MVPs"
when I say this, but an unbound form with an
"Update" button is the easiest way. The record
isn't saved until the user clicks the Update
button, so even if they just close the screen
it's not going to cause problems.

ManningFan, you've never been _flamed_ in these newgroups. You have only
been corrected for giving the bad advice of using unbound forms. My guess
is, as long as you feel compelled to offer bad advice to people asking
questions here, someone will respond to your post to indicate that it is bad
advice.

I observed flaming at the feet of the Flamemistresses and Flamemeisters in
the WRITING echo of the old FidoNet hobbyist network when the web was just
in its infancy. A well-constructed flame by someone who makes his or her
living with words is, like a thing of beauty, a joy forever. It will leave
the flamee shriveled and bent like the matchsticks used in old cartoon
reruns to indicate burnout. I've never seen any response to your posts that
came even close.

The OP will be well-advised to invest the time and effort to learn "The
Access Way". Once he groks how Access works, it will be trivially easy to
prevent an unintended update _and_ he won't be relying on his own code and
testing instead of the code that has been working in Access since 1993 and
tested in the real world by millions of users, billions (maybe trillions) of
times. It is advice that I will not bother to offer to you, yet another
time, as you have rejected it enough already.

Larry Linson, Microsoft Office Access MVP
Co-author: "Microsoft Access Small Business Solutions", published by Wiley
Access newsgroup support is alive and well in USENET
comp.databases.ms-access
Even the formerly-Microsoft-sponsored newsgroups are still around in most
news servers
 
M

ManningFan

I observed flaming at the feet of the Flamemistresses and Flamemeisters in
the WRITING echo of the old FidoNet hobbyist network when the web was just
in its infancy.

You should have been a Jethro Tull fan and seen the work of one
"Wilburn" 10 or so years back. That guy was so good he literally
killed the newsgroup. Actually he was more troll than flamemeister,
but he used to rip a few people in particular.

That being said, I still contend that sometimes Microsoft IS wrong,
and the "Access Way" is more of a pain in the arse than is necessary.
You say tomato, I say tomahto, but either way it tastes the same.
 
A

Access Developer

ManningFan said:
That being said, I still contend that sometimes
Microsoft IS wrong,

Yes, you are correct that Microsoft is sometimes wrong.
and the "Access Way" is more of a pain in
the arse than is necessary.

But, about this, it is you that are wrong.

If you insist on using unbound forms there's little, if any, advantage to
using Access instead of Classic VB (6.0 and earlier). Even with unbound
forms, I will admit that Access has the advantage over the world of DotNet.
You say tomato, I say tomahto, but either way it tastes the same.

Wait, aren't you thinking of our newsgroup colleague, Salad?
 

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