Calculated field does not update automatically

G

Guest

I am using this formula (below) in a field to calculate values in the Hours
fields. But when I enter data it does not show up until I hit a manual
refresh button or exit and then reopen the form. Is there something I can do
to force the field to show the calculation as soon as the data is entered?
Thanks for your help.

=Nz(DSum("[Hours]","Blank Time Card","
Code:
 =
'V'"))+Nz(DSum("[Hours2]","Blank Time Card","[Code2] =
'V'"))+Nz(DSum("[Hours3]","Blank Time Card","[Code3] =
'V'"))+Nz(DSum("[Hours4]","Blank Time Card","[Code4] =
'V'"))+Nz(DSum("[Hours5]","Blank Time Card","[Code5] =
'V'"))+Nz(DSum("[Hours6]","Blank Time Card","[Code6] =
'V'"))+Nz(DSum("[Hours7]","Blank Time Card","[Code7] = 'V'"))

The idea is someone enters the "V" code and the field will add up all the
hours associated with this code.
 
K

Ken Snell [MVP]

You're using a form, so this expression is the control source of a textbox
control, not a field, right?

You can use the AfterUpdate event of the textbox into which you're typing
the "V" to recalculate this textbox's expression:

Private Sub VTextboxName_AfterUpdate()
Me.Hours.Recalc
End Sub
 
G

Guest

I am still a little fuzzy on this.

Ken Snell said:
You're using a form, so this expression is the control source of a textbox
control, not a field, right?

You can use the AfterUpdate event of the textbox into which you're typing
the "V" to recalculate this textbox's expression:

Private Sub VTextboxName_AfterUpdate()
Me.Hours.Recalc
End Sub

--

Ken Snell
<MS ACCESS MVP>

ELL said:
I am using this formula (below) in a field to calculate values in the Hours
fields. But when I enter data it does not show up until I hit a manual
refresh button or exit and then reopen the form. Is there something I can do
to force the field to show the calculation as soon as the data is entered?
Thanks for your help.

=Nz(DSum("[Hours]","Blank Time Card","
Code:
 =
'V'"))+Nz(DSum("[Hours2]","Blank Time Card","[Code2] =
'V'"))+Nz(DSum("[Hours3]","Blank Time Card","[Code3] =
'V'"))+Nz(DSum("[Hours4]","Blank Time Card","[Code4] =
'V'"))+Nz(DSum("[Hours5]","Blank Time Card","[Code5] =
'V'"))+Nz(DSum("[Hours6]","Blank Time Card","[Code6] =
'V'"))+Nz(DSum("[Hours7]","Blank Time Card","[Code7] = 'V'"))

The idea is someone enters the "V" code and the field will add up all the
hours associated with this code.[/QUOTE]
[/QUOTE]
 
K

Ken Snell [MVP]

"fuzzy" means what exactly?

--

Ken Snell
<MS ACCESS MVP>

ELL said:
I am still a little fuzzy on this.

Ken Snell said:
You're using a form, so this expression is the control source of a textbox
control, not a field, right?

You can use the AfterUpdate event of the textbox into which you're typing
the "V" to recalculate this textbox's expression:

Private Sub VTextboxName_AfterUpdate()
Me.Hours.Recalc
End Sub

--

Ken Snell
<MS ACCESS MVP>

ELL said:
I am using this formula (below) in a field to calculate values in the Hours
fields. But when I enter data it does not show up until I hit a manual
refresh button or exit and then reopen the form. Is there something I
can
do
to force the field to show the calculation as soon as the data is entered?
Thanks for your help.

=Nz(DSum("[Hours]","Blank Time Card","
Code:
 =
'V'"))+Nz(DSum("[Hours2]","Blank Time Card","[Code2] =
'V'"))+Nz(DSum("[Hours3]","Blank Time Card","[Code3] =
'V'"))+Nz(DSum("[Hours4]","Blank Time Card","[Code4] =
'V'"))+Nz(DSum("[Hours5]","Blank Time Card","[Code5] =
'V'"))+Nz(DSum("[Hours6]","Blank Time Card","[Code6] =
'V'"))+Nz(DSum("[Hours7]","Blank Time Card","[Code7] = 'V'"))

The idea is someone enters the "V" code and the field will add up all the
hours associated with this code.[/QUOTE]
[/QUOTE][/QUOTE]
 
G

Guest

I keep getting a compile error:

Private Sub Code_AfterUpdate()
Me.Hours.Recalc
End Sub

Ken Snell said:
"fuzzy" means what exactly?

--

Ken Snell
<MS ACCESS MVP>

ELL said:
I am still a little fuzzy on this.

Ken Snell said:
You're using a form, so this expression is the control source of a textbox
control, not a field, right?

You can use the AfterUpdate event of the textbox into which you're typing
the "V" to recalculate this textbox's expression:

Private Sub VTextboxName_AfterUpdate()
Me.Hours.Recalc
End Sub

--

Ken Snell
<MS ACCESS MVP>

I am using this formula (below) in a field to calculate values in the
Hours
fields. But when I enter data it does not show up until I hit a manual
refresh button or exit and then reopen the form. Is there something I can
do
to force the field to show the calculation as soon as the data is entered?
Thanks for your help.

=Nz(DSum("[Hours]","Blank Time Card","
Code:
 =
'V'"))+Nz(DSum("[Hours2]","Blank Time Card","[Code2] =
'V'"))+Nz(DSum("[Hours3]","Blank Time Card","[Code3] =
'V'"))+Nz(DSum("[Hours4]","Blank Time Card","[Code4] =
'V'"))+Nz(DSum("[Hours5]","Blank Time Card","[Code5] =
'V'"))+Nz(DSum("[Hours6]","Blank Time Card","[Code6] =
'V'"))+Nz(DSum("[Hours7]","Blank Time Card","[Code7] = 'V'"))

The idea is someone enters the "V" code and the field will add up all the
hours associated with this code.[/QUOTE][/QUOTE]
[/QUOTE]
 
K

Ken Snell [MVP]

Change Recalc to Requery:

Me.Hours.Requery


--

Ken Snell
<MS ACCESS MVP>

ELL said:
I keep getting a compile error:

Private Sub Code_AfterUpdate()
Me.Hours.Recalc
End Sub

Ken Snell said:
"fuzzy" means what exactly?

--

Ken Snell
<MS ACCESS MVP>

ELL said:
I am still a little fuzzy on this.

:

You're using a form, so this expression is the control source of a textbox
control, not a field, right?

You can use the AfterUpdate event of the textbox into which you're typing
the "V" to recalculate this textbox's expression:

Private Sub VTextboxName_AfterUpdate()
Me.Hours.Recalc
End Sub

--

Ken Snell
<MS ACCESS MVP>

I am using this formula (below) in a field to calculate values in the
Hours
fields. But when I enter data it does not show up until I hit a manual
refresh button or exit and then reopen the form. Is there
something I
can
do
to force the field to show the calculation as soon as the data is entered?
Thanks for your help.

=Nz(DSum("[Hours]","Blank Time Card","
Code:
 =
'V'"))+Nz(DSum("[Hours2]","Blank Time Card","[Code2] =
'V'"))+Nz(DSum("[Hours3]","Blank Time Card","[Code3] =
'V'"))+Nz(DSum("[Hours4]","Blank Time Card","[Code4] =
'V'"))+Nz(DSum("[Hours5]","Blank Time Card","[Code5] =
'V'"))+Nz(DSum("[Hours6]","Blank Time Card","[Code6] =
'V'"))+Nz(DSum("[Hours7]","Blank Time Card","[Code7] = 'V'"))

The idea is someone enters the "V" code and the field will add up[/QUOTE] all
the[QUOTE]
hours associated with this code.[/QUOTE]
[/QUOTE][/QUOTE]
 

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