From: Dennis on
Hi,

I'm running Access via XP Office Pro under Windows 7.

Background -------------------

We are working on creating a cash receipt form. Checks are group into
"batches" of 20 checks. Someone adds up the checks using a calcuator. The
total from the calculator is called the "batch control total".

The cash receipts form has a form and a sub-form. The allows the user to
enter the batch number, batch date, control total amount (from manually run
caculator tape), and batch comment. The sub-form enables the user to enter
the individual checks. The control total amount's text control is called
txtCtlTotal.

In the footing of the sub-form, I calculate the total of the checks entered
by using a text box control called txtFFTotCash. The control's source is =
Sum(ChkAmt)

On the form, I also have two additional text box controls that were not
mentioned above. The first one is call txtBatchTot and its source is the
txtFFTotCash control in the sub-form's footer. The second control is called
txtDif and its source is = txtCtlTotal – txtBatchTot.

The second control indicates if the batch is in balance or not. If the
batch control total (txtCtlTotal) – total of checks entered (txtFFTotCash or
txtBatchTot) = 0, then the batch is in balance. If the amount is other than
zero, then the batch is out of balance.

All of the above works just fine. Here is my question.



Question ---------------------------------------------------------

As long as the txtCtlTotal is NOT zero, I was to display the message “Out of
Balance”. When the txtCtlTotal is set to zero, then I was the display to
disappear.

I've put code in txtDif's After Update, On Dirty, an On Change events to
make the message disappear (visible = False), but the events are not
triggered when the value of txtDif changes.

How do I get the Out of Balance message to disappear when the value of
txtDif changes to zero?

Thanks,

Dennis

From: Tom van Stiphout on
On Fri, 21 May 2010 19:40:05 -0700, Dennis
<Dennis(a)discussions.microsoft.com> wrote:

When you change the value of a control, its AfterUpdate event fires.
You can confirm that by setting a breakpoint in the procedure.

The only reason I can think of this would not occur is if somehow
(e.g. cut control, paste it) the event procedure is "disconnected"
from the event. Design the form, select the control, select the
properties window > Events tab, and click on the ... button to the
right of the event to reestablish the link.

-Tom.
Microsoft Access MVP


>Hi,
>
>I'm running Access via XP Office Pro under Windows 7.
>
>Background -------------------
>
>We are working on creating a cash receipt form. Checks are group into
>"batches" of 20 checks. Someone adds up the checks using a calcuator. The
>total from the calculator is called the "batch control total".
>
>The cash receipts form has a form and a sub-form. The allows the user to
>enter the batch number, batch date, control total amount (from manually run
>caculator tape), and batch comment. The sub-form enables the user to enter
>the individual checks. The control total amount's text control is called
>txtCtlTotal.
>
>In the footing of the sub-form, I calculate the total of the checks entered
>by using a text box control called txtFFTotCash. The control's source is =
>Sum(ChkAmt)
>
>On the form, I also have two additional text box controls that were not
>mentioned above. The first one is call txtBatchTot and its source is the
>txtFFTotCash control in the sub-form's footer. The second control is called
>txtDif and its source is = txtCtlTotal � txtBatchTot.
>
>The second control indicates if the batch is in balance or not. If the
>batch control total (txtCtlTotal) � total of checks entered (txtFFTotCash or
>txtBatchTot) = 0, then the batch is in balance. If the amount is other than
>zero, then the batch is out of balance.
>
>All of the above works just fine. Here is my question.
>
>
>
>Question ---------------------------------------------------------
>
>As long as the txtCtlTotal is NOT zero, I was to display the message �Out of
>Balance�. When the txtCtlTotal is set to zero, then I was the display to
>disappear.
>
>I�ve put code in txtDif�s After Update, On Dirty, an On Change events to
>make the message disappear (visible = False), but the events are not
>triggered when the value of txtDif changes.
>
>How do I get the Out of Balance message to disappear when the value of
>txtDif changes to zero?
>
>Thanks,
>
>Dennis
From: Dennis on
Tom

Your comment: When you change the value of a control, its AfterUpdate event
fires. You can confirm that by setting a breakpoint in the procedure.

Response: I thought the same thing. But when I put break points in the
After Update Event code, it never broke. I also tried the On Change and On
Dirty events for my txtDif control text box. None of those fired as Access
changed the value.

Remember, these are ALL calculated fields by Access. I never change then,
Access changes that values as I enter data into the sub-form.


Your comment: The only reason I can think of this would not occur is if
somehow (e.g. cut control, paste it) the event procedure is "disconnected"
from the event. Design the form, select the control, select the properties
window Events tab, and click on the ... button to the right of the event to
reestablish the link.


Response: I tried that. As a matter of fact, I have a break on the After
Update, Change, and On Dirty. None of that fire as I watch the values change
in the control bot.

Dennis
From: John W. Vinson on
On Fri, 21 May 2010 23:40:01 -0700, Dennis <Dennis(a)discussions.microsoft.com>
wrote:

>Response: I thought the same thing. But when I put break points in the
>After Update Event code, it never broke. I also tried the On Change and On
>Dirty events for my txtDif control text box. None of those fired as Access
>changed the value.

That is correct: programmatic changes to a control do not fire its events,
only actual user input. You'll need to use the afterupdate or other
appropriate event of the *manually entered* controls which underlie the
calculation, or some form event.
--

John W. Vinson [MVP]
From: Dennis on
John,

I'm entering the data in a subform called frmCash_sfCheck. The amount field
is called txtChkAmt. The procedure name that checks the batch balance is
called Check_Batch_Balance and resides in the form frmCash.

I understand that I need to modify the txtChkAmt_AfterUpdate event in the
sub-form frmCash_sfCheck to call the Check_Bacth_Balance in the frmCash form.

How do I do that?
Do I need to make the Check_Batch_Balance public and call it from the
sub-form or is there a way to call a procedure in the form from the sub-form
without making the form's procedure public?


Thanks

Dennis


--
Dennis


"John W. Vinson" wrote:

> On Fri, 21 May 2010 23:40:01 -0700, Dennis <Dennis(a)discussions.microsoft.com>
> wrote:
>
> >Response: I thought the same thing. But when I put break points in the
> >After Update Event code, it never broke. I also tried the On Change and On
> >Dirty events for my txtDif control text box. None of those fired as Access
> >changed the value.
>
> That is correct: programmatic changes to a control do not fire its events,
> only actual user input. You'll need to use the afterupdate or other
> appropriate event of the *manually entered* controls which underlie the
> calculation, or some form event.
> --
>
> John W. Vinson [MVP]
> .
>
 |  Next  |  Last
Pages: 1 2
Prev: Display data in a subform
Next: Bound Form Search