snoopy80
Technical User
- Jun 27, 2001
- 106
Hi,
Let say I have a form with 5 records that displays:
Last Fist Unit Cost TotCost chkbox
Smith John 2 $5.00 $10.00
Hill Mary 3 $2.00 $6.00
.
.
When I check the chkbox for example on Smith record I need the Cost and TotCost fields to set to Zero, then if I check the chkbox on Hill record, then the cost and totcost is also set to zero. But Now if I uncheck on Hill then cost and totcost would set it back to $2.00 and $6.00 respectively and if I uncheck Smith then $5.00 and $10.00 is restore back.
I have this Afterupdate event on the checkbox:
If Me!chkbox = -1 Then
Me!totcost = 0
Me!cost = 0
ElseIf chkbox <> -1 Then
Me!totcost.Value = varUnits * varcost
Me!cost.Value = varcost
End If
the varUnits and varcost is Global that is used to capture the unit and the cost when the unit textbox is updated in an event
My problem is when I uncheck Smith, it would set the 2 fields to zero then when I uncheck Hill is also set to zero that I want but now if I uncheck Hill, it will restore it back to $2.00 and $6.00 but if I uncheck Smith it also restore back to $2.00 and $6.00 instead of $5.00 and $10.00. I see the problem is the last check store the values in global var that is why it always restore the same value but How can I make it to save and restore the correct value for each record? Appreciate your helps.
Let say I have a form with 5 records that displays:
Last Fist Unit Cost TotCost chkbox
Smith John 2 $5.00 $10.00
Hill Mary 3 $2.00 $6.00
.
.
When I check the chkbox for example on Smith record I need the Cost and TotCost fields to set to Zero, then if I check the chkbox on Hill record, then the cost and totcost is also set to zero. But Now if I uncheck on Hill then cost and totcost would set it back to $2.00 and $6.00 respectively and if I uncheck Smith then $5.00 and $10.00 is restore back.
I have this Afterupdate event on the checkbox:
If Me!chkbox = -1 Then
Me!totcost = 0
Me!cost = 0
ElseIf chkbox <> -1 Then
Me!totcost.Value = varUnits * varcost
Me!cost.Value = varcost
End If
the varUnits and varcost is Global that is used to capture the unit and the cost when the unit textbox is updated in an event
My problem is when I uncheck Smith, it would set the 2 fields to zero then when I uncheck Hill is also set to zero that I want but now if I uncheck Hill, it will restore it back to $2.00 and $6.00 but if I uncheck Smith it also restore back to $2.00 and $6.00 instead of $5.00 and $10.00. I see the problem is the last check store the values in global var that is why it always restore the same value but How can I make it to save and restore the correct value for each record? Appreciate your helps.