Validation on a subform

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am quite new to using access but am learning very quickly.
I have a subform which has three yes/no fields on it. I want to restrict
the user so that they can only check one of them for each record in the sub
form.
The subform is based on a query in which I have a field which counts the
number of boxes checked, I want to include somehow a validation that would
say if field value is greater than one, then show a message box and restrict
the user from updating more than one tick box. I have tried putting
validation on the field on the sub form but with no luck.
Any help would be most appreciated.
 
I am quite new to using access but am learning very quickly.
I have a subform which has three yes/no fields on it. I want to restrict
the user so that they can only check one of them for each record in the sub
form.
The subform is based on a query in which I have a field which counts the
number of boxes checked, I want to include somehow a validation that would
say if field value is greater than one, then show a message box and restrict
the user from updating more than one tick box. I have tried putting
validation on the field on the sub form but with no luck.
Any help would be most appreciated.

You could try adding code behind each check box on its after update
property, so that when it is clicked it null's the other two boxes , this
would work if the form is not in a datasheet style.

the code would look like:

me!checkbox1 = true
me!checkbox2 = false
me!checkbox3 = false

you would need to change the code for each box to ensure the correct boxes
are nulled.

Falty
 
Sounds like you've gone a bit astray with your design. If you want to
impose an exclusive choice between three options then the convention is to
use an option group containing three option buttons. Access will then
ensure that only one of them can be selected. The group (rather than the
individual buttons) can then be bound to one field in the record source,
which will contain the value of the selected option button (probably 1, 2 or
3 in your case).
 
Back
Top