update calculated field in mainform when data is entered in subfor

  • Thread starter Thread starter Kelly
  • Start date Start date
K

Kelly

How can I get the calculated field to be updated without moving to another
record or entering another selection in the subform. It seems to lag behind.
Kelly
 
Karl,
I used this on the field that manipulates the calculated field in the
mainform but I still have to move to another record in the sub form to get
the calculated field to update. Where am I going wrong?

Private Sub NumberOfConductors_LostFocus()
Me.NumberOfConductors.Requery
End Sub

Kelly
 
I used this on the field that manipulates the calculated field in the
mainform
I do not know VBA.
Where is the text box that needs the display refreshed - main or sub?
Is this a bound object?
Where is the text box where you change data to trigger refresh - main or sub?
Is this a bound object?
 
The texbox that triggers a change is NumberOfConductors in the subform. When
an input into this field is used it then calculates text box
SumOfConductorArea with a control source of =Sum([SqIn]*[NumberOfConductors])
that is in the subform footer. This is then used in the text box
PercentageOfFill with a control source of
=CircuitDetailsubform!SumOfConductorArea/[AreaOfConduit]*100 that is located
in the main form. The problem is when you input the NumberOfConductors in the
subform the PercentageOfFill will not update unless you more to another
record. I hope this makes sense. Don't know which way to go with this.

Kelly
 
One solution would be to have macro to GoTo Next record followed by GoTo
Previous record.

--
Build a little, test a little.


Kelly said:
The texbox that triggers a change is NumberOfConductors in the subform. When
an input into this field is used it then calculates text box
SumOfConductorArea with a control source of =Sum([SqIn]*[NumberOfConductors])
that is in the subform footer. This is then used in the text box
PercentageOfFill with a control source of
=CircuitDetailsubform!SumOfConductorArea/[AreaOfConduit]*100 that is located
in the main form. The problem is when you input the NumberOfConductors in the
subform the PercentageOfFill will not update unless you more to another
record. I hope this makes sense. Don't know which way to go with this.

Kelly


KARL DEWEY said:
mainform
I do not know VBA.
Where is the text box that needs the display refreshed - main or sub?
Is this a bound object?
Where is the text box where you change data to trigger refresh - main or sub?
Is this a bound object?
 
Kelly,

Have you tried putting in the After_Update event of NumberOfConductors...

Me.PercentageOfFill.Requery

Of course that will only work if both fields are on the same subform, are
they?

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Kelly said:
The texbox that triggers a change is NumberOfConductors in the subform.
When
an input into this field is used it then calculates text box
SumOfConductorArea with a control source of
=Sum([SqIn]*[NumberOfConductors])
that is in the subform footer. This is then used in the text box
PercentageOfFill with a control source of
=CircuitDetailsubform!SumOfConductorArea/[AreaOfConduit]*100 that is
located
in the main form. The problem is when you input the NumberOfConductors in
the
subform the PercentageOfFill will not update unless you more to another
record. I hope this makes sense. Don't know which way to go with this.

Kelly


KARL DEWEY said:
mainform
I do not know VBA.
Where is the text box that needs the display refreshed - main or sub?
Is this a bound object?
Where is the text box where you change data to trigger refresh - main or
sub?
Is this a bound object?
 
Sorry Karl, This did not work it popped up a view of the subform. I put in
the macro Openform and selected the subform, then used GoToRecord Next and
GoToRecord Previous. then selected the macro name from teh properties. Am i
supposed to use something else?
Kelly


KARL DEWEY said:
One solution would be to have macro to GoTo Next record followed by GoTo
Previous record.

--
Build a little, test a little.


Kelly said:
The texbox that triggers a change is NumberOfConductors in the subform. When
an input into this field is used it then calculates text box
SumOfConductorArea with a control source of =Sum([SqIn]*[NumberOfConductors])
that is in the subform footer. This is then used in the text box
PercentageOfFill with a control source of
=CircuitDetailsubform!SumOfConductorArea/[AreaOfConduit]*100 that is located
in the main form. The problem is when you input the NumberOfConductors in the
subform the PercentageOfFill will not update unless you more to another
record. I hope this makes sense. Don't know which way to go with this.

Kelly


KARL DEWEY said:
I used this on the field that manipulates the calculated field in the
mainform
I do not know VBA.
Where is the text box that needs the display refreshed - main or sub?
Is this a bound object?
Where is the text box where you change data to trigger refresh - main or sub?
Is this a bound object?

--
Build a little, test a little.


:

Karl,
I used this on the field that manipulates the calculated field in the
mainform but I still have to move to another record in the sub form to get
the calculated field to update. Where am I going wrong?

Private Sub NumberOfConductors_LostFocus()
Me.NumberOfConductors.Requery
End Sub

Kelly


:

Use event Lost Focus to requery.
--
Build a little, test a little.


:

How can I get the calculated field to be updated without moving to another
record or entering another selection in the subform. It seems to lag behind.
Kelly
 
Thanks for the reply Gina I found out this did not work either. The
PercentageOfFill is on the main form and the NumberOfConductors is in the
subform. The requery I'm not familiar with how it works could I maybe use the
next field in the tab order to force the requery that would then update the
PercentageOfFill in the main form without going to the next row? It's
something about moving to another record that triggers the change.
Kelly


Gina Whipp said:
Kelly,

Have you tried putting in the After_Update event of NumberOfConductors...

Me.PercentageOfFill.Requery

Of course that will only work if both fields are on the same subform, are
they?

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Kelly said:
The texbox that triggers a change is NumberOfConductors in the subform.
When
an input into this field is used it then calculates text box
SumOfConductorArea with a control source of
=Sum([SqIn]*[NumberOfConductors])
that is in the subform footer. This is then used in the text box
PercentageOfFill with a control source of
=CircuitDetailsubform!SumOfConductorArea/[AreaOfConduit]*100 that is
located
in the main form. The problem is when you input the NumberOfConductors in
the
subform the PercentageOfFill will not update unless you more to another
record. I hope this makes sense. Don't know which way to go with this.

Kelly


KARL DEWEY said:
I used this on the field that manipulates the calculated field in the
mainform
I do not know VBA.
Where is the text box that needs the display refreshed - main or sub?
Is this a bound object?
Where is the text box where you change data to trigger refresh - main or
sub?
Is this a bound object?

--
Build a little, test a little.


:

Karl,
I used this on the field that manipulates the calculated field in the
mainform but I still have to move to another record in the sub form to
get
the calculated field to update. Where am I going wrong?

Private Sub NumberOfConductors_LostFocus()
Me.NumberOfConductors.Requery
End Sub

Kelly


:

Use event Lost Focus to requery.
--
Build a little, test a little.


:

How can I get the calculated field to be updated without moving to
another
record or entering another selection in the subform. It seems to
lag behind.
Kelly
 
Then try the below on you main form in the After_Update of the field that
gets updated...

Forms![YourSubform]![YourField].Requery

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Kelly said:
Thanks for the reply Gina I found out this did not work either. The
PercentageOfFill is on the main form and the NumberOfConductors is in the
subform. The requery I'm not familiar with how it works could I maybe use
the
next field in the tab order to force the requery that would then update
the
PercentageOfFill in the main form without going to the next row? It's
something about moving to another record that triggers the change.
Kelly


Gina Whipp said:
Kelly,

Have you tried putting in the After_Update event of NumberOfConductors...

Me.PercentageOfFill.Requery

Of course that will only work if both fields are on the same subform, are
they?

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Kelly said:
The texbox that triggers a change is NumberOfConductors in the subform.
When
an input into this field is used it then calculates text box
SumOfConductorArea with a control source of
=Sum([SqIn]*[NumberOfConductors])
that is in the subform footer. This is then used in the text box
PercentageOfFill with a control source of
=CircuitDetailsubform!SumOfConductorArea/[AreaOfConduit]*100 that is
located
in the main form. The problem is when you input the NumberOfConductors
in
the
subform the PercentageOfFill will not update unless you more to another
record. I hope this makes sense. Don't know which way to go with this.

Kelly


:

I used this on the field that manipulates the calculated field in
the
mainform
I do not know VBA.
Where is the text box that needs the display refreshed - main or sub?
Is this a bound object?
Where is the text box where you change data to trigger refresh - main
or
sub?
Is this a bound object?

--
Build a little, test a little.


:

Karl,
I used this on the field that manipulates the calculated field in
the
mainform but I still have to move to another record in the sub form
to
get
the calculated field to update. Where am I going wrong?

Private Sub NumberOfConductors_LostFocus()
Me.NumberOfConductors.Requery
End Sub

Kelly


:

Use event Lost Focus to requery.
--
Build a little, test a little.


:

How can I get the calculated field to be updated without moving
to
another
record or entering another selection in the subform. It seems to
lag behind.
Kelly
 
In the After_Update event I am just going to force DoCmd.GoToRecord , ,
acNext ito go to another record so the fields will populate correctly. For
some reason it just would not update. Thanks for all your help Gina and Karl.

Kelly


Gina Whipp said:
Then try the below on you main form in the After_Update of the field that
gets updated...

Forms![YourSubform]![YourField].Requery

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Kelly said:
Thanks for the reply Gina I found out this did not work either. The
PercentageOfFill is on the main form and the NumberOfConductors is in the
subform. The requery I'm not familiar with how it works could I maybe use
the
next field in the tab order to force the requery that would then update
the
PercentageOfFill in the main form without going to the next row? It's
something about moving to another record that triggers the change.
Kelly


Gina Whipp said:
Kelly,

Have you tried putting in the After_Update event of NumberOfConductors...

Me.PercentageOfFill.Requery

Of course that will only work if both fields are on the same subform, are
they?

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

The texbox that triggers a change is NumberOfConductors in the subform.
When
an input into this field is used it then calculates text box
SumOfConductorArea with a control source of
=Sum([SqIn]*[NumberOfConductors])
that is in the subform footer. This is then used in the text box
PercentageOfFill with a control source of
=CircuitDetailsubform!SumOfConductorArea/[AreaOfConduit]*100 that is
located
in the main form. The problem is when you input the NumberOfConductors
in
the
subform the PercentageOfFill will not update unless you more to another
record. I hope this makes sense. Don't know which way to go with this.

Kelly


:

I used this on the field that manipulates the calculated field in
the
mainform
I do not know VBA.
Where is the text box that needs the display refreshed - main or sub?
Is this a bound object?
Where is the text box where you change data to trigger refresh - main
or
sub?
Is this a bound object?

--
Build a little, test a little.


:

Karl,
I used this on the field that manipulates the calculated field in
the
mainform but I still have to move to another record in the sub form
to
get
the calculated field to update. Where am I going wrong?

Private Sub NumberOfConductors_LostFocus()
Me.NumberOfConductors.Requery
End Sub

Kelly


:

Use event Lost Focus to requery.
--
Build a little, test a little.


:

How can I get the calculated field to be updated without moving
to
another
record or entering another selection in the subform. It seems to
lag behind.
Kelly
 
That will do it also... I guess it just didn't have a trigger.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Kelly said:
In the After_Update event I am just going to force DoCmd.GoToRecord , ,
acNext ito go to another record so the fields will populate correctly. For
some reason it just would not update. Thanks for all your help Gina and
Karl.

Kelly


Gina Whipp said:
Then try the below on you main form in the After_Update of the field that
gets updated...

Forms![YourSubform]![YourField].Requery

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Kelly said:
Thanks for the reply Gina I found out this did not work either. The
PercentageOfFill is on the main form and the NumberOfConductors is in
the
subform. The requery I'm not familiar with how it works could I maybe
use
the
next field in the tab order to force the requery that would then update
the
PercentageOfFill in the main form without going to the next row? It's
something about moving to another record that triggers the change.
Kelly


:

Kelly,

Have you tried putting in the After_Update event of
NumberOfConductors...

Me.PercentageOfFill.Requery

Of course that will only work if both fields are on the same subform,
are
they?

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

The texbox that triggers a change is NumberOfConductors in the
subform.
When
an input into this field is used it then calculates text box
SumOfConductorArea with a control source of
=Sum([SqIn]*[NumberOfConductors])
that is in the subform footer. This is then used in the text box
PercentageOfFill with a control source of
=CircuitDetailsubform!SumOfConductorArea/[AreaOfConduit]*100 that is
located
in the main form. The problem is when you input the
NumberOfConductors
in
the
subform the PercentageOfFill will not update unless you more to
another
record. I hope this makes sense. Don't know which way to go with
this.

Kelly


:

I used this on the field that manipulates the calculated field
in
the
mainform
I do not know VBA.
Where is the text box that needs the display refreshed - main or
sub?
Is this a bound object?
Where is the text box where you change data to trigger refresh -
main
or
sub?
Is this a bound object?

--
Build a little, test a little.


:

Karl,
I used this on the field that manipulates the calculated field in
the
mainform but I still have to move to another record in the sub
form
to
get
the calculated field to update. Where am I going wrong?

Private Sub NumberOfConductors_LostFocus()
Me.NumberOfConductors.Requery
End Sub

Kelly


:

Use event Lost Focus to requery.
--
Build a little, test a little.


:

How can I get the calculated field to be updated without
moving
to
another
record or entering another selection in the subform. It seems
to
lag behind.
Kelly
 
Karl and Gina,
I stubbled across something this morning trying to avoid hitting an extra
tab again to move to next field. I'm not sure if you know about but I tried

Private Sub NumberOfConductors_AfterUpdate()
Me.Recalc
End Sub

And got the same result of the following that I put in Friday.

Private Sub NumberOfConductors_AfterUpdate()
DoCmd.GoToRecord , , acNext
DoCmd.GoToRecord , , acPrevious
End Sub

This updates the field and places you at the beginnig of that field
(NumberOfConductors) in the sub form. You still have to hit another tab but
it updates the two calculation fields in the subform that updates the field
in the main form. I thought I would pass it on in case you have not used it.

Kelly


Gina Whipp said:
That will do it also... I guess it just didn't have a trigger.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Kelly said:
In the After_Update event I am just going to force DoCmd.GoToRecord , ,
acNext ito go to another record so the fields will populate correctly. For
some reason it just would not update. Thanks for all your help Gina and
Karl.

Kelly


Gina Whipp said:
Then try the below on you main form in the After_Update of the field that
gets updated...

Forms![YourSubform]![YourField].Requery

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Thanks for the reply Gina I found out this did not work either. The
PercentageOfFill is on the main form and the NumberOfConductors is in
the
subform. The requery I'm not familiar with how it works could I maybe
use
the
next field in the tab order to force the requery that would then update
the
PercentageOfFill in the main form without going to the next row? It's
something about moving to another record that triggers the change.
Kelly


:

Kelly,

Have you tried putting in the After_Update event of
NumberOfConductors...

Me.PercentageOfFill.Requery

Of course that will only work if both fields are on the same subform,
are
they?

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

The texbox that triggers a change is NumberOfConductors in the
subform.
When
an input into this field is used it then calculates text box
SumOfConductorArea with a control source of
=Sum([SqIn]*[NumberOfConductors])
that is in the subform footer. This is then used in the text box
PercentageOfFill with a control source of
=CircuitDetailsubform!SumOfConductorArea/[AreaOfConduit]*100 that is
located
in the main form. The problem is when you input the
NumberOfConductors
in
the
subform the PercentageOfFill will not update unless you more to
another
record. I hope this makes sense. Don't know which way to go with
this.

Kelly


:

I used this on the field that manipulates the calculated field
in
the
mainform
I do not know VBA.
Where is the text box that needs the display refreshed - main or
sub?
Is this a bound object?
Where is the text box where you change data to trigger refresh -
main
or
sub?
Is this a bound object?

--
Build a little, test a little.


:

Karl,
I used this on the field that manipulates the calculated field in
the
mainform but I still have to move to another record in the sub
form
to
get
the calculated field to update. Where am I going wrong?

Private Sub NumberOfConductors_LostFocus()
Me.NumberOfConductors.Requery
End Sub

Kelly


:

Use event Lost Focus to requery.
--
Build a little, test a little.


:

How can I get the calculated field to be updated without
moving
to
another
record or entering another selection in the subform. It seems
to
lag behind.
Kelly
 
Kelly,

Oh we know about it... I guess it's a "...forest for the trees..." thing.
Glad you found that!

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Kelly said:
Karl and Gina,
I stubbled across something this morning trying to avoid hitting an extra
tab again to move to next field. I'm not sure if you know about but I
tried

Private Sub NumberOfConductors_AfterUpdate()
Me.Recalc
End Sub

And got the same result of the following that I put in Friday.

Private Sub NumberOfConductors_AfterUpdate()
DoCmd.GoToRecord , , acNext
DoCmd.GoToRecord , , acPrevious
End Sub

This updates the field and places you at the beginnig of that field
(NumberOfConductors) in the sub form. You still have to hit another tab
but
it updates the two calculation fields in the subform that updates the
field
in the main form. I thought I would pass it on in case you have not used
it.

Kelly


Gina Whipp said:
That will do it also... I guess it just didn't have a trigger.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Kelly said:
In the After_Update event I am just going to force DoCmd.GoToRecord , ,
acNext ito go to another record so the fields will populate correctly.
For
some reason it just would not update. Thanks for all your help Gina and
Karl.

Kelly


:

Then try the below on you main form in the After_Update of the field
that
gets updated...

Forms![YourSubform]![YourField].Requery

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Thanks for the reply Gina I found out this did not work either. The
PercentageOfFill is on the main form and the NumberOfConductors is
in
the
subform. The requery I'm not familiar with how it works could I
maybe
use
the
next field in the tab order to force the requery that would then
update
the
PercentageOfFill in the main form without going to the next row?
It's
something about moving to another record that triggers the change.
Kelly


:

Kelly,

Have you tried putting in the After_Update event of
NumberOfConductors...

Me.PercentageOfFill.Requery

Of course that will only work if both fields are on the same
subform,
are
they?

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

The texbox that triggers a change is NumberOfConductors in the
subform.
When
an input into this field is used it then calculates text box
SumOfConductorArea with a control source of
=Sum([SqIn]*[NumberOfConductors])
that is in the subform footer. This is then used in the text box
PercentageOfFill with a control source of
=CircuitDetailsubform!SumOfConductorArea/[AreaOfConduit]*100 that
is
located
in the main form. The problem is when you input the
NumberOfConductors
in
the
subform the PercentageOfFill will not update unless you more to
another
record. I hope this makes sense. Don't know which way to go with
this.

Kelly


:

I used this on the field that manipulates the calculated
field
in
the
mainform
I do not know VBA.
Where is the text box that needs the display refreshed - main or
sub?
Is this a bound object?
Where is the text box where you change data to trigger refresh -
main
or
sub?
Is this a bound object?

--
Build a little, test a little.


:

Karl,
I used this on the field that manipulates the calculated field
in
the
mainform but I still have to move to another record in the sub
form
to
get
the calculated field to update. Where am I going wrong?

Private Sub NumberOfConductors_LostFocus()
Me.NumberOfConductors.Requery
End Sub

Kelly


:

Use event Lost Focus to requery.
--
Build a little, test a little.


:

How can I get the calculated field to be updated without
moving
to
another
record or entering another selection in the subform. It
seems
to
lag behind.
Kelly
 
Back
Top