allow deletions

C

Charlie Horse

Hi
I have a continuous subform. One of the fields is chkbox. When the
chkbox=Yes, I would like the AllowDeletions = No, for that row. If in the
next row the chkbox=No, than I would like the AllowDeletions = Yes.
The AllowDeletions default is Yes.

My code in the frmContinuousSubForm is as follows:

Sub Form_Current()
If me.chkbox = Yes Then
Forms!frmMain!frmContinuousSubform.Form.AllowDeletions = No
Else
Forms!frmMain!frmContinuousSubform.Form.AllowDeletions = Yes
End If
End Sub

The results have been unpredictable. At one time I would get the exact
opposite of what I wanted. I was able to delete the records where
chkbox=Yes. I reread code to make sure I did not inverse my yes/no criteria
but it looked correct.
Thanks for the help.
Charlie
 
K

Klatuu

AllowDeletions is at the form level, not the row level. Since you have this
code in the current event, the value will dictate whether the form will allow
or deny deletes for all records, not the current one.
 
C

Charlie Horse

Klatuu,
Thank you for the response. I don't write code often but I thought that the
On Current property was for the current record of the form. Is there a way
to prevent deleting an individual record in a continuous form?
Carla
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top