On Fri, 23 Jul 2010 04:47:39 -0700 (PDT),
cornedbeef007-(E-Mail Removed)
wrote:
> Why the insistance that this happen on every keystroke,
>> rather than as soon as the value has been entered?
>
>Detecting the end of entry is my problem I suppose.
The control's AfterUpdate fires at the end of the entry. That's what it's FOR.
>That's why I think
>I need to update at each keystroke.
>
>Working your way down the form with details like account name, bsb
>number, cheque number, entry amount, donation amount.
>
>You could update Total when "entry" loses focus, but after entering
>"donation" amount, you would (probably) click the "Save" button to
>save the record.
Or just move to the new record, and let Access save it for you automatically.
You don't *need* a Save button. You can certainly include one, but it's belt
and suspenders!
>If updating Total happened at Donation.LostFocus, you wouln't see the
>total update.
Ummm... and why not?
>I'd like it to update as each figure is typed, if I can.
>The input boxes, and the underlying table fields are formated
>Currency, with a default of 0. The boxes initially show "$0.00".
The format is irrelevant.
If you insist, note that the Change event fires at every keystroke. The
textbox's Value property is not changed until the user moves to another
control, but its Text property will be current. The sum will, of course, be
wrong - if you've typed "12" then it will add 12, even if the value being
entered is 125 - but if that's what you want:
Private Sub Donation_Change()
Me!txtTotal = Val(Me!Entry) + Val(Me!Donation.Text)
End Sub
Note that this uses the Text property, which is a String, so you need the
Val() to convert it to a number (an incorrect number) which can be added.
You'll need similar code in the Entry textbox's change event.
--
John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/For...-US/accessdev/
http://social.answers.microsoft.com/.../en-US/addbuz/
and see also
http://www.utteraccess.com