Event 'After Update'

  • Thread starter Thread starter ZBC
  • Start date Start date
Z

ZBC

I have a form whos Record Source is based on a query.
The form contain several TextBoxes all of which have their Control
Sources 'Data' connected to fields the query.
I am trying to get the Event 'After Update' of one of the textboxes to
add the contents two of the Textboxes and place the sum in third
TextBox. I cannot seem to get syntax the expression properly configured.
Any examples would be greatly appreciated.

Bob
 
ZBC said:
I have a form whos Record Source is based on a query.
The form contain several TextBoxes all of which have their Control
Sources 'Data' connected to fields the query.
I am trying to get the Event 'After Update' of one of the textboxes to
add the contents two of the Textboxes and place the sum in third
TextBox. I cannot seem to get syntax the expression properly configured.
Any examples would be greatly appreciated.

You're not giving much detail here but generically...

Me!ThirdField = Me!FirstField + Me!SecondField

To handle either field being Null you might need...

Me!ThirdField = Nz(Me!FirstField,0) + Nz(Me!SecondField,0)
 
Thanks!
I am confused, however, with regard to the concern for a Null?
I can see a problem with division by zero, but is there a problem with
trying to add or multiply a null or zero field?
 
"ZBC" (e-mail address removed)> wrote in message
Thanks!
I am confused, however, with regard to the concern for a Null?
I can see a problem with division by zero, but is there a problem with trying
to add or multiply a null > or zero field?

If not handled properly any expression containing a Null operand will evaluate
to Null.

Null + 100 = Null
Null * 5 = Null
10 + 3 * (4 + 1) - Null = Null
etc..
 
Thanks! ... Somewhere I think I read that about Nulls ....
Meanwhile, I get a error message regarding "can't find the micro ..."
when trying to make an expression as you suggested.
It also seems to want to put another = sign at the beginning.
 
"ZBC" (e-mail address removed)> wrote in message
Thanks! ... Somewhere I think I read that about Nulls ....
Meanwhile, I get a error message regarding "can't find the micro ..." when trying to make an
expression as you suggested.
It also seems to want to put another = sign at the beginning.

Procedure code doesn't go directly in the event property box. You enter [Event
Procedure] from the list of choices and then press the build [...] button.
This will take you to the code module window for the event and the line of code
goes there.
 
Rick,

I get the following error error message: "The expression After Update
you entered as the event property setting produced the following error:
The object doesn't contain the Automation object 'Me.'."
....

Bob

Rick said:
"ZBC" (e-mail address removed)> wrote in message
Thanks! ... Somewhere I think I read that about Nulls ....
Meanwhile, I get a error message regarding "can't find the micro ..." when
trying to make an

expression as you suggested.
It also seems to want to put another = sign at the beginning.

Procedure code doesn't go directly in the event property box. You enter [Event
Procedure] from the list of choices and then press the build [...] button.
This will take you to the code module window for the event and the line of code
goes there.
 
ZBC said:
I get the following error error message: "The expression After Update you entered as the event
property setting produced the following error: The object doesn't contain the Automation object
'Me.'."

What exactly do you have entered in the property box named "After Update"? It
should be "[Event Procedure]" (without the quotes). If that is what you have
then what does your code look like?
 
I put "Me!NewReserveNumber = Nz(Me!CURRES,0) + Nz(Me!ReserveChange,0)"
in the code.

I now get "[Event Procedure]" in "After Update" ... don't know what I did different???

It's getting late ... I will try again tomorrow.
Thanks for all you help.

Bob



Rick said:
Rick,




I get the following error error message: "The expression After Update you
entered as the event

property setting produced the following error: The object doesn't contain the
Automation object


What exactly do you have entered in the property box named "After Update"? It
should be "[Event Procedure]" (without the quotes). If that is what you have
then what does your code look like?
 
Back
Top