Calculated control event order

M

Michelle K.

Apologies if this shows up more than once - thought I had it posted but it's
not showing up.

I have a calculated control on a subform whose value I need to "copy" to a
bound control on the main form. Can't just use [main form]!boundcontrol
=subform!calccontrol because the bound control needs to be able to be edited
at the users discretion (ie. the calculated value is a 'suggestion' that may
or may not be what the user wants.).

I can't find an event that is triggered by a change in value of a calculated
field that will allow me to use code to send the new value to the bound
control. Also, it appears that the calculated field is not updated until
sometime after the GotFocus event of the next control on the subform -- so
using subform!calccontrol_AfterUpdate (or any other event of calccontrol)
doesn't trigger the update of [main form]!boundcontrol. I am saving the
record in the calccontrol_AfterUpdate event code before attempting to trigger
the update of the main form bound control.

Any suggestions would be greatly appreciated!
 
M

Marshall Barton

Michelle said:
I have a calculated control on a subform whose value I need to "copy" to a
bound control on the main form. Can't just use [main form]!boundcontrol
=subform!calccontrol because the bound control needs to be able to be edited
at the users discretion (ie. the calculated value is a 'suggestion' that may
or may not be what the user wants.).

I can't find an event that is triggered by a change in value of a calculated
field that will allow me to use code to send the new value to the bound
control. Also, it appears that the calculated field is not updated until
sometime after the GotFocus event of the next control on the subform -- so
using subform!calccontrol_AfterUpdate (or any other event of calccontrol)
doesn't trigger the update of [main form]!boundcontrol. I am saving the
record in the calccontrol_AfterUpdate event code before attempting to trigger
the update of the main form bound control.


There is no event or any other way to tell when a control's
expression has been calculated. The reason is that control
expression calculations are done at a lower priority than
VBA code and data entry processing.

The way to do what you want is to use VBA code to calculate
the both controls.
 
M

Michelle K.

Thanks for your response, Marsh. I don't know why I'm having problems
finding my posts when I use the Search For. I did finally get to them (it
did post both times!) by leavng the search empty. The important bit of
information is that Jeanette answered my question on the other post. This
forum is incredibly helpful and I really appreciate all you experts who take
the time to answer questions.

Michelle K.

Marshall Barton said:
Michelle said:
I have a calculated control on a subform whose value I need to "copy" to a
bound control on the main form. Can't just use [main form]!boundcontrol
=subform!calccontrol because the bound control needs to be able to be edited
at the users discretion (ie. the calculated value is a 'suggestion' that may
or may not be what the user wants.).

I can't find an event that is triggered by a change in value of a calculated
field that will allow me to use code to send the new value to the bound
control. Also, it appears that the calculated field is not updated until
sometime after the GotFocus event of the next control on the subform -- so
using subform!calccontrol_AfterUpdate (or any other event of calccontrol)
doesn't trigger the update of [main form]!boundcontrol. I am saving the
record in the calccontrol_AfterUpdate event code before attempting to trigger
the update of the main form bound control.


There is no event or any other way to tell when a control's
expression has been calculated. The reason is that control
expression calculations are done at a lower priority than
VBA code and data entry processing.

The way to do what you want is to use VBA code to calculate
the both controls.
 

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

Top