The trouble with CheckBoxes ...

Posted on 2011-10-20
Medium Priority
Last Modified: 2012-05-12
... 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?
Question by:MikeDTE
  • 3
LVL 10

Accepted Solution

ALaRiva earned 1000 total points
ID: 37002658
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

LVL 49

Expert Comment

by:Dale Fye
ID: 37002670
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


LVL 49

Expert Comment

by:Dale Fye
ID: 37002689
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.
LVL 49

Expert Comment

by:Dale Fye
ID: 37002692
Or you might even do this with a popup form, rather than a subform.

Author Comment

ID: 37002739
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.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month17 days, 10 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question