problems with Check Boxes

teel73

Registered User.
Local time
Today, 05:06
Joined
Jun 26, 2007
Messages
205
I hope I can explain this correctly: I have 6 check boxes on (FormA). On(FormB) I have 6 check boxes that initially are disabled. Depending on what the user checks on (FormA) will enable the corresponding check boxes on(formB). The end user will check the enabled boxes on (FormB) as they receive the information. Then I have a control called [date_completed] that is disabled. This is where my problem is. When all of the enabled check boxes have been checked I want to enable the control [date_completed]. How do I code that to work for any combination of the 6 boxes? I can code it for 2 or 3 boxes, but 6 checkboxes will be too many combinations. Is there more simple way?
 
If all the checkboxes are marked yes you want to be able to enter a date... correct? If so... use the "Tag" property of the checkboxes. Then an "If....Then" statement.
 
Last edited:
Not quite. Basically, if checkbox rvd_credit and checkbox rvd_motorVR and checkbox rvd_SSN are supposed to be checked those checkboxes would be enabled. As each document has been reviewed the end user will check the appropriate box. The [date completed] field should not become enabled until all three boxexs have been checked. And there is no specific order that the can be checked. For three boxes, it's easy. This is what I have:

Code:
If [ckbx_rvd_credit ].value = -1 and [ckbx_rvd_motorVR ].value = -1 and [ckbx_rvd_SSN].value = -1 then
     [date_completed].enabled = true
Else
     [date_completed].enabled = false
Endif

This will work but the problem is there are 6 check boxes and it can be any combination of the 6 that are enabled. How do I check for the enabled check boxes?
 
As I said... cover all your checkboxes by putting an "*" in the Tag property... Then code like this will pick up all checkboxes with "*"

untested code.... might have to play with it.... but basically goes like this....

Dim ctl as Control
For Each ctl In Me.Controls

If ctl.ControlType = acCheckBox Then
If ctl.Tag = "*" Then
me.DateField.enabled = True
else me.Datefield.enabledd = False
end if
end if
Next ctl
 
does this code go on the onClick event of each checkbox?
 
well, you probably noticed an error in there....should be

Dim ctl As Control

For Each ctl In Me.Controls

If ctl.ControlType = acCheckBox Then
If ctl.Tag = "*" And ctl.Value = -1 Then
Me.Date.Enabled = True
Exit For
Else: Me.Date.Enabled = False
End If

Next ctl

But I havent tested this on checkboxes... might have to make it into a function and call the function from the onclick of each checkbox....
 

Users who are viewing this thread

Back
Top Bottom