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

a2k - offering a Cancel option

P: n/a
Alot of my forms are bound.

I would like to offer a Cancel option so that they can make as many changes
as they like and still Cancel out without making any changes.

I have one idea of how to do this for new records; tag each record with a
boolean value. On clicking OK, these are all set to True and the form
closes.
If they Cancel the False records are deleted and the form closes.

Not too sure what to do if they change an existing record and then exit.

What strategies do people use? Do I have to face the task of unbinding
everything?

thanks
Martin
Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Personally I've never had an app that required this processing but I can
think of lots.

I think your idea is fine. You can deal with changes by using the form
beforeupdate event to set the tag to false.

You could not do this with an unbound form. On a continuous form unbound
controls take the same value for every visible record.

I'm not sure why you think you have a problem.

Peter Russell

Deano previously wrote:
Alot of my forms are bound.

I would like to offer a Cancel option so that they can make as many
changes
as they like and still Cancel out without making any changes.

I have one idea of how to do this for new records; tag each record
with a
boolean value. On clicking OK, these are all set to True and the form
closes.
If they Cancel the False records are deleted and the form closes.

Not too sure what to do if they change an existing record and then exit.

What strategies do people use? Do I have to face the task of unbinding
everything?

thanks
Martin


Nov 13 '05 #2

P: n/a
Deano wrote:
Alot of my forms are bound.

I would like to offer a Cancel option so that they can make as many changes
as they like and still Cancel out without making any changes.

I have one idea of how to do this for new records; tag each record with a
boolean value. On clicking OK, these are all set to True and the form
closes.
If they Cancel the False records are deleted and the form closes.

Not too sure what to do if they change an existing record and then exit.


OK, so to summarize they can both add and edit records in your bound
form, and hitting 'Cancel' should cancel ALL the edits and updates to
all records that were made that session.

If your application is single user, no problem. Copy the recordsource
to a temporary table, add a "Dirty" flag to each new and edited record.
Upon OK'ing the session, copy/update all records with the dirty flag
set to the original table.

If your application is multi-user, you're going to have to add a
'LastEdited' timestamp to all the records in the source table. In the
temporary table include this timestamp field, do not update it if you
edit a record, but do update the dirty flag. Note that you may have to
be tricky about key generation if you can have multiple users doing this
at once. When the session is OK'ed, copy all NEW records to the source
table, and update only existing edited records if the timestamp fields
are equal. Update the timestamp fields for those records.

For records where they are not equal, some other user has already edited
them and saved their changes. Present these records to the user and
allow them 2 choices: (1) discard your changes (2) get a fresh copy of
these records so you can make the changes over again.

Nov 13 '05 #3

P: n/a
The simplest approach is to allow as many changes as they like TO A GIVEN
RECORD, and give them the option to cancel by displaying a MsgBox in the
BeforeUpdate event. But my understanding, though it isn't crystal clear to
me, is that you want to allow the user to change as many fields in as many
records in a "session" and then cancel _all_ those changes.

I think the suggestions you have already received, of using a temporary
table to hold the modified records, and then doing a "batch" update on
closing the form are the simplest way to handle that. But it is not very
"granular" -- only allowing the user to cancel _all_ changes, not _specific_
ones.

Larry Linson
Microsoft Access MVP
"Deano" <de*********@hotmail.com> wrote in message
news:40**********************@ptn-nntp-reader01.plus.net...
Alot of my forms are bound.

I would like to offer a Cancel option so that they can make as many changes as they like and still Cancel out without making any changes.

I have one idea of how to do this for new records; tag each record with a
boolean value. On clicking OK, these are all set to True and the form
closes.
If they Cancel the False records are deleted and the form closes.

Not too sure what to do if they change an existing record and then exit.

What strategies do people use? Do I have to face the task of unbinding
everything?

thanks
Martin

Nov 13 '05 #4

P: n/a
Larry Linson wrote:
The simplest approach is to allow as many changes as they like TO A
GIVEN RECORD, and give them the option to cancel by displaying a
MsgBox in the BeforeUpdate event. But my understanding, though it
isn't crystal clear to me, is that you want to allow the user to
change as many fields in as many records in a "session" and then
cancel _all_ those changes.

I think the suggestions you have already received, of using a
temporary table to hold the modified records, and then doing a
"batch" update on closing the form are the simplest way to handle
that. But it is not very "granular" -- only allowing the user to
cancel _all_ changes, not _specific_ ones.

Larry Linson
Microsoft Access MVP


Thanks for all the replies.

My viewpoint is based on what I've seen in other apps used in my area of
work. Basically you may enter a form, make some changes and then you have
to Save. If you don't save and instead click Cancel then any changes you've
made are lost.

I like this in the sense that it offers a safety net of sorts. Sometimes I
have to show someone a record and then change a few things to show another
possible scenario. But I actually want to keep the original data so a
Cancel option is quite useful.

As I see this approach in other programs and it doesn't seem to bother
users, it's an attractive option to implement.
Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.