call AfterUpdate Inductively

G

Guest

Hello, I am having problem calling After Update between form/subform.

Here is the information:
I have a [Enter Invoice] form with a [Products] subform (spreadsheet).
[Enter Invoice] includes textboxes: SubTotal, Discount, TaxRate, Tax, Total
....etc
its subform [Products] includes: SubTotal, Price ...etc
in [Products] subform, Price(s) are summed in SubTotal, then copied to
SubTotal in [Enter Invoice]. Then Tax and then Total are calculated (but tax
can also change by keyboard!).
So, order of update is: Price->SubTotal->SubTotal->Tax->Total (4 steps)
and want each control to call the next control's After Update Event in its
own After Update Event Procedure (or else only keyboard entry causes
AfterUpdate Event to fire [only on step forward]).

Now the problem is in step 2:
here is how I wrote [Products].SubTotal After Update procedure:
Private Sub SubTotal_AfterUpdate()
Me.Parent.SubTotal.Requery
'Forms![Enter Invoice]!SubTotal.[After Update]
'Forms![Enter Invoice]![SubTotal].AfterUpdate
'Me.Parent.SubTotal_AfterUpdate
End Sub
I am trying to set the value of the next control (on main form) and then
call its After Update procedure. But none of the 3 statements I have
commented out have worked. They give me runtime error 438 "object does not
support this property or method"

What am I doing wrong in SubTotal_AfterUpdate() ?
Thanks in advance.
 
S

strive4peace

To synopsize what you have:

main form --> [Enter Invoice]
with controls:SubTotal, Discount, TaxRate, Tax, Total, etc

subform --> [Products]
with controls: SubTotal --> =sum([price])

After you update the Price on the subform, you should save
the record -- this will cause the Products SubTotal to update

you are doing
Me.Parent.SubTotal.Requery

why have you not followed this format to call the procedures
that you need...

ie:
Call Me.Parent.SubTotal_AfterUpdate()

what is the real purpose of your code? Perhaps it would be
better to put the statements in the subform code. It
appears that you are storing calculated values... this is
dangerous as values can be changed that are not updated and,
since they are calculated, they can be calculated anytime

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
Hello, I am having problem calling After Update between form/subform.

Here is the information:
I have a [Enter Invoice] form with a [Products] subform (spreadsheet).
[Enter Invoice] includes textboxes: SubTotal, Discount, TaxRate, Tax, Total
...etc
its subform [Products] includes: SubTotal, Price ...etc
in [Products] subform, Price(s) are summed in SubTotal, then copied to
SubTotal in [Enter Invoice]. Then Tax and then Total are calculated (but tax
can also change by keyboard!).
So, order of update is: Price->SubTotal->SubTotal->Tax->Total (4 steps)
and want each control to call the next control's After Update Event in its
own After Update Event Procedure (or else only keyboard entry causes
AfterUpdate Event to fire [only on step forward]).

Now the problem is in step 2:
here is how I wrote [Products].SubTotal After Update procedure:
Private Sub SubTotal_AfterUpdate()
Me.Parent.SubTotal.Requery
'
ie:
Forms![Enter Invoice]!SubTotal.[After Update]
'Forms![Enter Invoice]![SubTotal].AfterUpdate
'Me.Parent.SubTotal_AfterUpdate
End Sub
I am trying to set the value of the next control (on main form) and then
call its After Update procedure. But none of the 3 statements I have
commented out have worked. They give me runtime error 438 "object does not
support this property or method"

What am I doing wrong in SubTotal_AfterUpdate() ?
Thanks in advance.
 
G

Guest

Good, problem solved. Now that I made sure Me.Parent.SubTotal_AfterUpdate()
is the currect way of calling the fuction I made it work (at first I forgot I
was using the private procedure and gave me error! I made it public, it
worked).

Now my form values are updated immidiately which is good; their control
sources [in the tables] are best (i think) changed when i am finished with
the form (save record, move to new record....), but change in real-time as I
change the form. That is all right!

Except for Subtotal the rest of controls take control source from inside a
table. SubTotal (calculated value) is not stored in any table. If it is still
dangerous please let me know.

thanks

strive4peace" <"strive4peace2006 at yaho said:
To synopsize what you have:

main form --> [Enter Invoice]
with controls:SubTotal, Discount, TaxRate, Tax, Total, etc

subform --> [Products]
with controls: SubTotal --> =sum([price])

After you update the Price on the subform, you should save
the record -- this will cause the Products SubTotal to update

you are doing
Me.Parent.SubTotal.Requery

why have you not followed this format to call the procedures
that you need...

ie:
Call Me.Parent.SubTotal_AfterUpdate()

what is the real purpose of your code? Perhaps it would be
better to put the statements in the subform code. It
appears that you are storing calculated values... this is
dangerous as values can be changed that are not updated and,
since they are calculated, they can be calculated anytime

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
Hello, I am having problem calling After Update between form/subform.

Here is the information:
I have a [Enter Invoice] form with a [Products] subform (spreadsheet).
[Enter Invoice] includes textboxes: SubTotal, Discount, TaxRate, Tax, Total
...etc
its subform [Products] includes: SubTotal, Price ...etc
in [Products] subform, Price(s) are summed in SubTotal, then copied to
SubTotal in [Enter Invoice]. Then Tax and then Total are calculated (but tax
can also change by keyboard!).
So, order of update is: Price->SubTotal->SubTotal->Tax->Total (4 steps)
and want each control to call the next control's After Update Event in its
own After Update Event Procedure (or else only keyboard entry causes
AfterUpdate Event to fire [only on step forward]).

Now the problem is in step 2:
here is how I wrote [Products].SubTotal After Update procedure:
Private Sub SubTotal_AfterUpdate()
Me.Parent.SubTotal.Requery
'
ie:
Forms![Enter Invoice]!SubTotal.[After Update]
'Forms![Enter Invoice]![SubTotal].AfterUpdate
'Me.Parent.SubTotal_AfterUpdate
End Sub
I am trying to set the value of the next control (on main form) and then
call its After Update procedure. But none of the 3 statements I have
commented out have worked. They give me runtime error 438 "object does not
support this property or method"

What am I doing wrong in SubTotal_AfterUpdate() ?
Thanks in advance.
 
S

strive4peace

you're welcome, glad you got it!

As long as you are not storing calculated values in your
tables, everything should be ok :) It is best to show
calculations on forms and reports when you need to see them.

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
Good, problem solved. Now that I made sure Me.Parent.SubTotal_AfterUpdate()
is the currect way of calling the fuction I made it work (at first I forgot I
was using the private procedure and gave me error! I made it public, it
worked).

Now my form values are updated immidiately which is good; their control
sources [in the tables] are best (i think) changed when i am finished with
the form (save record, move to new record....), but change in real-time as I
change the form. That is all right!

Except for Subtotal the rest of controls take control source from inside a
table. SubTotal (calculated value) is not stored in any table. If it is still
dangerous please let me know.

thanks

:

To synopsize what you have:

main form --> [Enter Invoice]
with controls:SubTotal, Discount, TaxRate, Tax, Total, etc

subform --> [Products]
with controls: SubTotal --> =sum([price])

After you update the Price on the subform, you should save
the record -- this will cause the Products SubTotal to update

you are doing
Me.Parent.SubTotal.Requery

why have you not followed this format to call the procedures
that you need...

ie:
Call Me.Parent.SubTotal_AfterUpdate()

what is the real purpose of your code? Perhaps it would be
better to put the statements in the subform code. It
appears that you are storing calculated values... this is
dangerous as values can be changed that are not updated and,
since they are calculated, they can be calculated anytime

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
Hello, I am having problem calling After Update between form/subform.

Here is the information:
I have a [Enter Invoice] form with a [Products] subform (spreadsheet).
[Enter Invoice] includes textboxes: SubTotal, Discount, TaxRate, Tax, Total
...etc
its subform [Products] includes: SubTotal, Price ...etc
in [Products] subform, Price(s) are summed in SubTotal, then copied to
SubTotal in [Enter Invoice]. Then Tax and then Total are calculated (but tax
can also change by keyboard!).
So, order of update is: Price->SubTotal->SubTotal->Tax->Total (4 steps)
and want each control to call the next control's After Update Event in its
own After Update Event Procedure (or else only keyboard entry causes
AfterUpdate Event to fire [only on step forward]).

Now the problem is in step 2:
here is how I wrote [Products].SubTotal After Update procedure:
Private Sub SubTotal_AfterUpdate()
Me.Parent.SubTotal.Requery
'

ie:
Forms![Enter Invoice]!SubTotal.[After Update]
'Forms![Enter Invoice]![SubTotal].AfterUpdate
'Me.Parent.SubTotal_AfterUpdate
End Sub
I am trying to set the value of the next control (on main form) and then
call its After Update procedure. But none of the 3 statements I have
commented out have worked. They give me runtime error 438 "object does not
support this property or method"

What am I doing wrong in SubTotal_AfterUpdate() ?
Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top