Code to reset checkbox to "0"

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to find out how to reset a value to "0" when a checkbox is unchecked.
I have the following event code for when the box is checked, and need to know
how to tell it to set back to "0" when unchecked. When I uncheck the box,
the value I've told it to give remains there. Any help is much appreciated!
Thanks!! Here's the code I have in place:
.....Private Sub Gift_Services_Click()
[Gift] = 0.25
End Sub....
 
CLICK and CHECK are not the same.

You need to do your code in the checkbox's BEFORE UPDATE code.

The code should be something like...

If Gift_Services = true then
[Gift] = 0.25
Else
[Gift] = 0
end if
 
Wendy said:
I need to find out how to reset a value to "0" when a checkbox is unchecked.
I have the following event code for when the box is checked, and need to know
how to tell it to set back to "0" when unchecked. When I uncheck the box,
the value I've told it to give remains there. Any help is much appreciated!
Thanks!! Here's the code I have in place:
....Private Sub Gift_Services_Click()
[Gift] = 0.25
End Sub....


I think you want:

Private Sub Gift_Services_Click()
If Me.Gift = 0 Then
Me.Gift = 0.25
Else
Me.Gift = 0
End If
End Sub
 
Actually, the CLICK event may work, but you still need to tell it what the
two cases are.


--
Rick B



Rick B said:
CLICK and CHECK are not the same.

You need to do your code in the checkbox's BEFORE UPDATE code.

The code should be something like...

If Gift_Services = true then
[Gift] = 0.25
Else
[Gift] = 0
end if




--
Rick B



I need to find out how to reset a value to "0" when a checkbox is unchecked.
I have the following event code for when the box is checked, and need to know
how to tell it to set back to "0" when unchecked. When I uncheck the box,
the value I've told it to give remains there. Any help is much appreciated!
Thanks!! Here's the code I have in place:
....Private Sub Gift_Services_Click()
[Gift] = 0.25
End Sub....
 
Wow!! Thanks guys! I have it working now.
W~

Rick B said:
Actually, the CLICK event may work, but you still need to tell it what the
two cases are.


--
Rick B



Rick B said:
CLICK and CHECK are not the same.

You need to do your code in the checkbox's BEFORE UPDATE code.

The code should be something like...

If Gift_Services = true then
[Gift] = 0.25
Else
[Gift] = 0
end if




--
Rick B



I need to find out how to reset a value to "0" when a checkbox is unchecked.
I have the following event code for when the box is checked, and need to know
how to tell it to set back to "0" when unchecked. When I uncheck the box,
the value I've told it to give remains there. Any help is much appreciated!
Thanks!! Here's the code I have in place:
....Private Sub Gift_Services_Click()
[Gift] = 0.25
End Sub....
 
Back
Top