Re: Checkbox (default to no) - must be checked before saving/exiting
- From: Tom van Stiphout <tom7744.no.spam@xxxxxxx>
- Date: Mon, 26 Oct 2009 06:55:01 -0700
On Mon, 26 Oct 2009 06:21:02 -0700, nicolam1980
<nicolam1980@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
The appropriate place to make this check is in Form_BeforeUpdate,
because you can set Cancel=True which prevents user from leaving the
form.
if me.myCheckbox1.value = false
or me.myCheckbox2.value = false
or me.myCheckbox3.value = false
then Cancel = True
If you literally mean "all checkboxes" you could alternatively write:
dim ctl as control
for each ctl in me.controls
if typeof(ctl) is checkbox then
if ctl.Value = false then
Cancel = True
Exit For
end if
end if
next
(of course you replace myObjectNames with yours)
-Tom.
Microsoft Access MVP
Hi.
I have a feeling this might be a basic question but am new to access so
please be patient!!
I am creating a database for a team at work to use instead of paper
checklists. One such section I am creating concerns priority checks - I have
Yes/No boxes on the form that are defaulted to No.
I need to ensure people cannot save a record or exit the DB if any of these
boxes are left unchecked - can anyone help?
Thanks
Nicola
- References:
- Checkbox (default to no) - must be checked before saving/exiting
- From: nicolam1980
- Checkbox (default to no) - must be checked before saving/exiting
- Prev by Date: Re: Defaults in Cascaded Combo Boxes
- Next by Date: unbound fields on a form
- Previous by thread: Checkbox (default to no) - must be checked before saving/exiting
- Next by thread: Re: Checkbox (default to no) - must be checked before saving/exiting
- Index(es):
Relevant Pages
|