Douglas J. Steele said:
I think Graham may have mixed them up. Try:
Private Sub chkPresent_Click()
Me!chkAbsent = Not Me!chkPresent
End Sub
Private Sub chkAbsent_Click()
Me!chkPresent = Not Me!chkAbsent
End Sub
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
Thanks,that works! The only thing now is that you can't uncheck the
boxes
once they have been checked, so for instance if you mark a pupil as
being
present then find you have made a mistake you can't edit the check box.
:
Hilary,
Open the subform in design view. Then add the appropriate code to each
checkbox's Click event:
Private Sub chkPresent_Click()
Me!chkPresent = Not Me!chkAbsent
End Sub
Private Sub chkAbsent_Click()
Me!chkAbsent = Not Me!chkPresent
End Sub
Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------
Impressed by your prompt response!
I'm afraid its a bit more complicated than that. I have the subform
in
datasheet view so that I can scroll quickly down the Present
'column'
using
the down key (rather than having to labouriously tab across each row
if
it
was in normal view) and option groups just show up as numbers in
Datasheet
view. Also not all the students register at each session so I would
have
to
have 3 options Prsent/Absent/not registering. I have already set up
several
crosstab queries etc which calculate their average attendance etc
based
on
the Yes/no check boxes so I would prefer to stick to these if
possible.
sorry to be difficult.
:
Hilary,
You don't need two checkboxes for that. You can get away with only
one
=
Present. If it's value is True, the student is present, otherwise
they're
absent. Problem solved without validation.
If you absolutely want two buttons, change them to Option Boxes,
and
place
them inside an Option Group, which forces only one of them to be
checked
at
any one time. Again, problem solved without validation.
Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------
I have a student registration database with a main form,
Cont_Regist_Form,
with the SessionID and SessionDate with a continuous subform
named
Cont_Regist_Subform with the PupilID, PupilName and Yes/No check
boxes
for
Present and Absent linked via the SessionID.
To prevent pupils being accidently marked in as both present and
absent I
have set the Validation on the Absent check box in the subform as
([Present]
Is Null). This works but throws up an error message if the pupil
has
been
marked as Present at ANY session. Could someone give me an
expression/code
to
link the validation to the SessionID in the main form?
This is probably very basic but I am new to Access.