View Full Version : Checkbox and datagrid


dr223
02-11-2009, 05:23 AM
Hallo,

I have a checkbox which I called ToPay (design name), this checkbox is unbounded with other bounded fields in a datagrid called DgvToPay.

Also note, When the form is loaded the datagrid is populated and the checkbox checked always (i.e,. threestate set to True).

What I want to do is when Checkbox (3rd Column) is unchecked the respective AmounttobePaid field (4th Column) is set to £0.00. Instead of what is displayed on the datagrid.

Please could you tell me the coding and where to insert the code.

Thank you very much

JANR
02-11-2009, 05:45 AM
In the after_update event of your checkbox3 use something like this:

Private Sub chk3_AfterUpdate()
If (Me.chk3 = True) Then
Me.AmounttobePaid = 0
Else
'do nothing
End If
End Sub

Replace Me.chk3 with the NAME of your checkbox in "column 3"
If you want to undo the change this can't be used, the change is permanent for Amounttobepaid the instant you click in the checkbox.

JR

dr223
02-11-2009, 05:53 AM
Is this in VB.net 2005. Because i wanted to change the desin name to Me.chk3 but it says Me.chk is not a valid identifier.

I named it ToPay before

Thanks

JANR
02-11-2009, 06:02 AM
Didn't see that you posted in VB.net, in access ME is a short refrence to controls on the form. I don't know much about VB.net

JR

dr223
02-11-2009, 06:08 AM
Thanks anyway JR