Re: Aborting form entry
- From: "Peter Hallett" <PeterHallett@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 20 May 2005 14:55:36 -0700
Thank you for your suggestion but it appears not to work as required.
I have a continuous form bound to a table. It comprises about six records
relating to the same number of individuals. Each record has a cash deposit
field and a balance field. When a cash deposit is made, the balance is
automatically updated. Being a continuous form, account servicing can be
done for any number of individuals while the form is on display. The problem
with the method you suggested is that the Before Update event code actually
runs as each individual deposit field is updated, rather than on form
closure. It is clearly impractical to have to accept or cancel each
individual entry at the point of submission when what is needed is the
ability to accept or reject the whole form at the point of closure. I cannot
make your code perform this task.
--
Peter Hallett
"Lynn Trapp" wrote:
> Have you tried putting something like the following code in the BeforeUpdate
> event of your form?
>
> If MsgBox("Do You Wish To Save", vbYesNo) = vbNo Then
> Cancel = True
> End If
>
> --
> Lynn Trapp
> MS Access MVP
> www.ltcomputerdesigns.com
> Access Security: www.ltcomputerdesigns.com/Security.htm
> Jeff Conrad's Big List: www.ltcomputerdesigns.com/JCReferences.html
>
>
> "Peter Hallett" <PeterHallett@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:3B16EAD1-E824-4653-9BAF-FFF6811AD347@xxxxxxxxxxxxxxxx
> > Access seems to suffer from a major defect (correct me if I am wrong). If
> > a
> > form is bound to a table then there appears to be no simple way of
> > abandoning
> > any subsequent data entry. Whatever method of exit is chosen, the
> > contents
> > of the form are saved to the bound table when the form is closed. (It was
> > pointed out to me by one of this newsgroup's MVPs that 'No Save' does not
> > mean what I, and many others, I gather, assumed it to mean, until
> > disabused
> > of the misapprehension.)
> >
> > This can be a serious limitation. If, for example, extensive amendments
> > are
> > made to an employee's personal record, only to discover, at a late stage,
> > that the changes have been carried out on the wrong record, then the
> > logical
> > way to rectify the situation would be to abandon the form and start again
> > but
> > that does not seem to be possible. The alternative is to return all the
> > fields to their original values before closing the form but that is often
> > impractical, or at best very inconvenient - even for those with a good
> > memory.
> >
> > I have frequently overcome the problem by copying selected records to a
> > buffer table, using an append query, then binding the form to that buffer
> > table. Aborting data entry is then easy. On closing the form, its fields
> > are saved to the buffer table which can then be deleted without affecting
> > the
> > source table. If the values are to be saved, then the source table is
> > updated from the buffer table using one or more update queries but this is
> > not always the most appropriate solution. With a continuous form bound to
> > a
> > whole table, for example, rollback might be a more satisfactory technique,
> > starting a transaction, based on the bound table, when the form is opened,
> > and presenting the options of either committing the transaction or rolling
> > it
> > back when data entry is complete - but I cannot get this to work. I have
> > studied the example accompanying the Help topic 'BeginTrans, CommitTrans,
> > Rollback Methods' but although the code I have written, based on this
> > example, compiles and runs without complaint, it does nothing. Whatever I
> > do, all fields modified on a form are always saved back to its bound
> > table.
> > Can some kind soul please help, ideally with a few lines of VBA?
> >
> > --
> > Peter Hallett
>
>
>
.
- Follow-Ups:
- Re: Aborting form entry
- From: Albert D.Kallal
- Re: Aborting form entry
- References:
- Aborting form entry
- From: Peter Hallett
- Re: Aborting form entry
- From: Lynn Trapp
- Aborting form entry
- Prev by Date: Echo off and on
- Next by Date: Forms help
- Previous by thread: Re: Aborting form entry
- Next by thread: Re: Aborting form entry
- Index(es):
Relevant Pages
|