The trouble with CheckBoxes ...

... is that if you click on them the checkbox immediately toggles to the reverse value.

I have a Checkbox (BBReq) which allows the user to specify whether a particular Participant attending an Event requires Bed & Breakfast accomodation.

If the value in BBReq is True then data can be entered into the BBCost, BBCharge, BBExtras, BBQtyGuests, BBQtyNights, BBStartDate, BBEnSuiteReq, BBDisAccReq, BBQtySingle, BBQtyDouble, BBQtyTwin, BBQtyFamily, BBName and BBRef (i.e. quite a lot of data).

If the value in BBReq is False then none of these fields are available (locked) and are all empty of data.

So far no problem.

If BBReq on Form load is False and it is clicked then it goes to True and I unlock all the BB fields - agian this is no problem.

Here is the problem

If BBReq on form load is True and it is clicked then it goes to False and I want to cancel all the values in the BB fields ... BUT I want to warn the user that the data is about to be cleared and give them a chance to change their mind.  I use a VBOKCancel msgbox to do this.

It all works but if the operation is cancelled the BBReq checkbox remains unchecked and the user may then worry that the Cancel has not worked (despite all the other fields having not been cleared of data).

Is there any way of resetting the BBReq CheckBox with a tick?
Who is Participating?
Just set it to true if they decide to cancel. I'm assuming you check for which action they choose OK or Cancel. So if they cancel, just use ...

myCheckBox = true

Dale FyeCommented:
What code are you using?

It should look something like:

Private sub chk_BBReq_Click

    if me.chk_BBReq.oldValue = True and me.chk_BBReq.value = False then

        if msgbox("Are you sure", vbOkCancel) = vbCancel then
            me.txt_BBCost = NULL
            me.txt_BBCost.Locked = true
            me.txt_BBRef = NULL
            me.txt_BBRef.locked = true
        end if


Dale FyeCommented:
forgot the End Sub in previous post.

However, if I were doing this, I think I would have all of the Bed & Breakfast info in a separate table and use a subform, linked by event and person to the main table.

If the the user checks BBReq or BBReq is already checked, then make the subform visible .  If there is no current record, add one.

If the user unchecks BBReq, then confirm thats what they want to do, then delete the associated record from the B&B table and hide the subform.
Dale FyeCommented:
Or you might even do this with a popup form, rather than a subform.
MikeDTEAuthor Commented:
OK the answer was a simple as

Me.BBreq = True

basically as suggested by ALaRiva - the points go to ALaRiva - thanks v much.

I swear I tried this first (before my initial post) but it didn't work!!!

I did try the .undo option but it didn't work.

I am too far into this form to split it away to a subform and seperating the B&B data into it's own table is just too much work for someting as simple as a tick in a box.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.