Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can't set value to 0

Status
Not open for further replies.

amna77

Programmer
May 27, 2003
69
0
0
GB
hi I have one field on my form, which just calculte the total, like Total=sum(([Blush])+([Burn])) . now when i click on add new record, all forms clears up, but this total field does not. in there value stays the same. any help, how to do clear that.
i try to put codes on the add new button.
like Me.Total.Value = 0, but keep me error message that can't assiagn a value to this object.
Please help. thanks
 
If total is just the sum of two other fields on the same record then you just want:
=field1 +field2
 
no actually its not only 2 fields, its more then 2 fields, here i just put down 2 as a example.
=Sum(([Blush])+([Burn])+([Contanmination])+([Drag Marks/ Scratches])+([Flash])+([Flow Marks])+([Pin Flush])+([Short])+([Sink])+([Splay])+([Missing Inserts])+([Def Inserts])+([Pad Print])+([Tissing Pad Print])+([Other])+([OBAFailure]))
thanks
 
How are ya amna77 . . . . .

At the end of your code in your [blue]Add Button[/blue] try:
Code:
[blue]Me.Recalc[/blue]

Calvin.gif
See Ya! . . . . . .
 
Thanks for reply, but still not working.
 
amna77 . . . . .

And just what do you get with Me.Recalc added?

Calvin.gif
See Ya! . . . . . .
 
no error message, but that total value stays same.
 
Hmmmmm . . . . .

Is the [purple]button[/purple] on a [blue]MainForm[/blue] and the [purple]totals control[/purple] on a [blue]subForm[/blue] or vice versa?

Calvin.gif
See Ya! . . . . . .
 
no every thing on the same form, i don't have sub form.
 
You know what, instead of =Sum(()+([Burn])+([Contanmination])+([Drag Marks/ Scratches]).....))
I just did [Burn]+[Contamination]+[DragMarks].. and so on.

and i left the same codes on me.recalc on the add button. and now it did put the value of 0 in the total field.

Thanks alot for the help.
thanks
 
If the calculated field is not a bound one then instead of Me.Recalc you can try either
Code:
Me.CalculatedFiled.SetFocus
Me.CalculatedFiled=0
or
Code:
Me.CalculatedFiled.SetFocus
Me.CalculatedFiled=""

Zameer Abdulla
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top