Solved Not allowing user to delete record in subform (datasheet view) (1 Viewer)

Ashisht76

Member
Local time
Today, 23:58
Joined
Jan 31, 2022
Messages
44
Hello everyone!

Thanks in advance for giving your precious time to read my post.

My Form has subform that has its source Record a Query for showing conditional data, the problem is that user can select record and press delete button from keyboard to delete record from that which i don't want. I have posted picture of form for better understanding where arrow is marked from where user can select the record.
1) i can not use lock or unable property as I want user to select Yes/No field.
2) I tied putting code "me.AllowDeletions = False " on "OnEntre" event of subfrom frame, that too does nothing.

Please help, thanks once again.
 

Attachments

  • Screenshot_1.png
    Screenshot_1.png
    70.7 KB · Views: 147

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:28
Joined
May 7, 2009
Messages
19,169
on design view of the subform, set AllowDeletions to No.
 

Ashisht76

Member
Local time
Today, 23:58
Joined
Jan 31, 2022
Messages
44
on design view of the subform, set AllowDeletions to No.
HI, Sorry i have to edit my previous comments as i tired it on wrong Form, so the thing is that as i have mentioned that this is query that sits in Form /Subform frame, hence there is no such options available in first place. Please find screen shot of the same. Thanks.
 

Attachments

  • Screenshot_2.png
    Screenshot_2.png
    57.9 KB · Views: 124
  • Screenshot_3.png
    Screenshot_3.png
    55.9 KB · Views: 133
Last edited:

Ashisht76

Member
Local time
Today, 23:58
Joined
Jan 31, 2022
Messages
44
I have been searching for solution on net and found similar issue in below site, Please also have a look at it that might make some sense. If i try to apply it here then according to it I will have to show my query in layout view but I dont know how can i do it with query in Subform/ Subreport frame.

 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:28
Joined
May 7, 2009
Messages
19,169
you can add code to the Main Form's Load event, to disable deletion from subform:

private sub form_load()
me!child43.Form.AllowDeletions = False
end sub
 

Ashisht76

Member
Local time
Today, 23:58
Joined
Jan 31, 2022
Messages
44
you can add code to the Main Form's Load event, to disable deletion from subform:

private sub form_load()
me!child43.Form.AllowDeletions = False
end sub
You nailed it again, Thanks a ton for the help.
 

Users who are viewing this thread

Top Bottom