Check Boxes (1 Viewer)

Russ

New member
Local time
Today, 08:27
Joined
Jan 26, 2000
Messages
5
Hello

I was hoping someone could possibly tell me where I am going wrong with MS Access. I have created a form which has a certain number of area's which have check boxes some area's have two check boxes and some have three. The check boxes are labelled as Yes, No or n/a. The two check box fields have Yes and No as answers and the three check boxes have Yes, No and n/a. I have set the default value of the check boxes to Null. I am trying to implement a validation rule which will only allow one of the boxes to be checked at any given time. I can get it to validate the following

No box checked (User is not able to select either Yes or n/a)
n/a box checked (User is not able to select either Yes or No)

I have attached the formula I have used.

(Earthing1Yes, Earthing1No and Earthing1na) are the field names.

No Formula

=IIf([Earthing1No] And [Earthing1na]=True Or [Earthing1na] And [Earthing1Yes]=True=True,Null,True)

n/a Formula

=IIf([Earthing1No] And [Earthing1na]=True Or [Earthing1Yes] And [Earthing1na]=True=True,Null,True)

Yes Formula

=IIf([Earthing1No] And [Earthing1Yes]=True Or ([Earthing1na] And [Earthing1Yes]=True)=True,Null,True)

but when the Yes box is checked the User can check the No box but not the n/a box. I have tried putting each of the seperate expressions in brackets but it still has the same effect. Why is this happening?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 03:27
Joined
Feb 19, 2002
Messages
43,213
To get this to work easily, you'll need to go back and change your form and your table. Delete the checkboxes you have already added and remove the multiple checkboxes from the table. Read the help entries for option groups and radio buttons before you start this and also back up your database.

Replace each of the multiple checkboxes with a numeric column that will hold the value that represents the choice. Then for each group of options, add an option group control to the form. Inside the option group control, add the appropriate number of radio buttons ( GUI standards dictate ratio buttons when you want someone to pick only one option of a group. Checkboxes are used when multiple selections are allowed.).

The option group is the control that will be bound to your table column. It will return a single numeric value depending on which button is depressed.

You won't need to do any editing in code, Access will take care of ensuring that only one value in the correct range is returned for the option group control.
 

Users who are viewing this thread

Top Bottom