If check box changes

D

deb

Access 2003

On my subform I have 3 checkboxes format Yes\No
BBAll - control source BBAll default Yes
BB1 - control source BB1 default No
BB2 - control source BB2 default No
and 2 textboxes
TextBB1 - control source =DLookUp("[BB1]","[t000Facts]","[UnitID] =" &
[UnitNo])
TextBB2 - control source =DLookUp("[BB2]","[t000Facts]","[UnitID] =" &
[UnitNo])

If TextBB1 is null then BB1.enabled=false
If TextBB2 is null then BB2.enabled=false
this means if TextBB1 is empty then the BB1 checkbox selection is
disabled(same for BB2).

cannot have BBAll=yes if BB1 or BB2= yes
and cannot have BB1 or Bb2 =yes if BBAll is checked

so here is what I need
If user wants to change from BBAll to BB1 or BB2 or BB1 and BB2, then have
BBAll auto uncheck.
If user wants to change from BB1 or BB2 or both to BBAll then BB1 and BB2
will auto uncheck.
Should not have BBAll checked if any other checkbox is checked, and if any
other checkbox is check then BbAll should be unchecked.
Oh my...
I'm so stuck!!
 
D

Daryl S

If TextBB1 is null then BB1.enabled=false else BB1.enabled=true
If TextBB2 is null then BB2.enabled=false else BB2.enabled=true

Then, based on what the user clicks, add these code entries:

on the BB1_Click event:

If Me.BB1 Then BBAll = False Else BBAll = True
If Me.BB2 Then BBAll = False

on the BB2_Click event:

If Me.BB2 Then BBAll = False Else BBAll = True
If Me.BB1 Then BBAll = False

on the BBAll_Click event:
If Me.BBAll Then
Me.BB1 = False
Me.BB2 = False
Else
If Me.BB1.enabled OR Me.BB2.enabled Then
If (Not Me.BB2) AND (Not Me.BB1) Then msgbox "Be sure to select BB1 or
BB2"
Else
Me.BBAll = True
Msgbox "BBAll must be checked because BB1 and BB2 are not able to be
checked."
End If
End If

This is untested, and the control names may be different from yours, so work
with it and let us know.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

if duplicate goto record 3
complicated subform beforeupdate 1
update check box 3
Check Box 4
Blank Fields in Report 2
What event occurs After form record is loaded 2
Need help with code 3
Query/check box issue 1

Top