Before insert and check box and subform

  • Thread starter Thread starter a
  • Start date Start date
A

a

Thank You
I have subform and form (Master form)
The Master Form Contain Check box name checkbox1
the subform is (data sheet) and allow addition = true
In the subform before insert event I try all the next code but not work
correct I want prevent user from data entery until check box = true or
checked
why all of this code not work???
====================
(1)
If Parent.checkbox1.Value = False Then
Cancel = True
Else
'
End If
============
(2)
If Parent.checkbox1.Value = 0 Then
Cancel = True
Else
'
End If
===================
(3)
If Me.Parent.checkbox1.Value = 0 Then
Cancel = True
Else
'
End If
========================
Why all this code not work correctly
 
Try setting the subform's Data Entry to Yes (property dialog, data tab)

Jeanette Cunningham
 
a said:
Thank You
I have subform and form (Master form)
The Master Form Contain Check box name checkbox1
the subform is (data sheet) and allow addition = true
In the subform before insert event I try all the next code but not work
correct I want prevent user from data entery until check box = true or
checked
why all of this code not work???
====================
(1)
If Parent.checkbox1.Value = False Then
Cancel = True
Else
'
End If
============
(2)
If Parent.checkbox1.Value = 0 Then
Cancel = True
Else
'
End If
===================
(3)
If Me.Parent.checkbox1.Value = 0 Then
Cancel = True
Else
'
End If
========================
Why all this code not work correctly


In principle, all of these should work, and do in a test form I set up. Is
checkbox1 a bound control, or unbound? Is it actually False when you test
the code, or is it possible that it is Null (looking rather gray instead of
white)? What happens if you check it and then un-check it, and then try to
add a record in the subform?
 
Thank Mr
Dirk Goldgar
About Your Reply And Help

The Code work when assign defult value to checkbox1 to 0
 
a said:
Thank Mr
Dirk Goldgar
About Your Reply And Help

You're welcome.
The Code work when assign defult value to checkbox1 to 0

That implies that the checkbox was Null before, and that's why the code
wasn't working. I trust that your fix has corrected the problem. If not,
write back.
 
Back
Top