Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Save record on lost focus

Geek News

Save record on lost focus
randria 12/12/2008 9:06:00 PM
Hi,

In a countinuous form, I have 2 controls ctrA and ctrB that make up a set of
records. I have control ctrC on the form footer counting the records if ctrA
has a value regardless of the ctrB's value.
ctrC counts the records only after the user moved to the next line or to
another set of record. So in a situation where the user deletes ctrA's value,
and straight away close the form, ctrC will have an incorrect count. so I m
wondering if it is possible to save the record on ctrA lost focus. Or
stopping the form to close so that the user can to a different record/next
line ( although I dont really like this ) before closing.
Many thanks.

RE: Save record on lost focus
Beetle 12/12/2008 9:35:01 PM
Try;

If Me.Dirty Then Me.Dirty = False

In the Close event
--
_________

Sean Bailey


"randria" wrote:

[Quoted Text]
> Hi,
>
> In a countinuous form, I have 2 controls ctrA and ctrB that make up a set of
> records. I have control ctrC on the form footer counting the records if ctrA
> has a value regardless of the ctrB's value.
> ctrC counts the records only after the user moved to the next line or to
> another set of record. So in a situation where the user deletes ctrA's value,
> and straight away close the form, ctrC will have an incorrect count. so I m
> wondering if it is possible to save the record on ctrA lost focus. Or
> stopping the form to close so that the user can to a different record/next
> line ( although I dont really like this ) before closing.
> Many thanks.
>
RE: Save record on lost focus
randria 12/13/2008 6:22:01 AM
Hi Beetle,

Many thanks for your advice, I put the code On change and it works
perfectly. Many thanks.

"Beetle" wrote:

[Quoted Text]
> Try;
>
> If Me.Dirty Then Me.Dirty = False
>
> In the Close event
> --
> _________
>
> Sean Bailey
>
>
> "randria" wrote:
>
> > Hi,
> >
> > In a countinuous form, I have 2 controls ctrA and ctrB that make up a set of
> > records. I have control ctrC on the form footer counting the records if ctrA
> > has a value regardless of the ctrB's value.
> > ctrC counts the records only after the user moved to the next line or to
> > another set of record. So in a situation where the user deletes ctrA's value,
> > and straight away close the form, ctrC will have an incorrect count. so I m
> > wondering if it is possible to save the record on ctrA lost focus. Or
> > stopping the form to close so that the user can to a different record/next
> > line ( although I dont really like this ) before closing.
> > Many thanks.
> >
Re: Save record on lost focus
John W. Vinson <jvinson[ at ]STOP_SPAM.WysardOfInfo.com> 12/13/2008 6:40:15 AM
On Fri, 12 Dec 2008 22:22:01 -0800, randria
<randria[ at ]discussions.microsoft.com> wrote:

He did NOT specify the change event - and that event fires *with every
keystroke*, so it's not the appropriate event in any case.

I'd use the AfterUpdate event myself, but many events will work.


[Quoted Text]
>Hi Beetle,
>
>Many thanks for your advice, I put the code On change and it works
>perfectly. Many thanks.
>
>"Beetle" wrote:
>
>> Try;
>>
>> If Me.Dirty Then Me.Dirty = False
>>
>> In the Close event
>> --
--

John W. Vinson [MVP]

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net