Hi Vince. I have to make an assumption or two here and if not true, this won't work: Your total field is the line total of one record. It is not a calculated field. If so:
Place your form in design view. Double-click on your checkbox. This will pop up its "properties" dialog. Find the events tab, then find "After update". Select "Event Procedure" and then click on the "..." button beside. This will open up the Visual Basic module behind the form, and label a "sub" procedure for you. In between the subs title and "end sub", copy in this and modify the names to suit your field name to the name of your "total field":
On Error Resume Next
If IsNull(Me.YourFieldName) Or Me.YourFieldName = 0 Then Exit Sub
Me.YourFieldName = Me.YourFieldName * -1
Close the module and click on our totals field. Same steps: Events tab, After update, "..." button to open VB and label a sub. Paste this in between and modify the names:
On Error Resume Next
If Me.YourFieldName < 0 Then
Me.YourCheckBoxName = -1
Else
Me.YourCheckBoxName = 0
End If
If your totals is a calculated field, you would have to refer to (example) a unit price field, if quantity * unit price = Total.
What this also does is if you already have a negative value in the field it will flip the check box to "unchecked" if you change your total value to a positive or zero. If you want this to "stick", your check box would have to be "bound" to a Yes/No field in your table. If you just want to use it when you enter records, you don't have to bother. Gord
ghubbell@total.net
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.