Check box validation

mitch_moseley

New member
Local time
Today, 13:11
Joined
Nov 12, 2014
Messages
5
At the moment I am doing a database as part of my A level. On my form I have two tick boxes; Invoice dispatched? and Paid? I need to make it so the 'Invoice dispatched' box has to be ticked before the 'Paid' box can be ticked, so the paid box can't be ticked unless the invoice box is ticked. Is there any validation rule that makes this happen?
 

Attachments

  • checkbox.jpg
    checkbox.jpg
    97.9 KB · Views: 139
chkInvoiceDispatched onClick Event:
Code:
chkPaid.Enabled = CBool(chkInvoiceDispatched.Value)

Try that out.
 
I would by default make the Paid checkbox 'enabled = false'
then in the AfterUpdate event for dispatched (if checked), set the Paid checkbox 'enabled = true'.
You may need to do it in the Current event for the form too, in case returning to a record where dispatched is checked.
 
we don't normally help with homework, but this is how.

you need code, rather than validation.

you need code in the current event, and in the dispatchedafterupdate event. you need it in both so that it works as you navigate through records, and after you change the current record. This is a general thing with validation stuff like this. You generally need to add stuff to the current event.

note that it is still not properly debugged, as a user COULD tick dispatch, then tick paid, then untick dispatch.

but anyway

Code:
 if chkdispatched then
     paid.enabled =  true
 else
     paid.enabled =  false
 end if
this can be stated more concisely, but maybe slightly harder to understand, as

Code:
 paid.enabled = chkdispatched
 
You should have the Paid check box disabled /hidden until the invoice check box is updated to Yes.

Attach an after update event to the invoice check box something like
Code:
 If me.chkInvoicePaid = 1 Then
me.chkPaid.enabled = True
End if

Substitute your form field names where appropriate.
You should also code it to reverse this if the box is unticked.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom