• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 585
  • Last Modified:

subform "AllowDeletions = No" not working if use Delete Key

hi

I have a subform and have set AllowDeletions = No on both the parent form and sub form.

If I try to delete a record with the Menu or right mouse click it does not allow (so far so good) but if I select an entire record(s) and use the keyboard Delete key then the record(s) DO get deleted. what gives, I thought that would be disabled too??
0
LukeB
Asked:
LukeB
  • 2
1 Solution
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
That should not be happening.  Something else is going on ...

Can you upload the db (sanitized) ?

mx
0
 
Rey Obrero (Capricorn1)Commented:
first set the key preview event of the subform to yes

use this code in the keydown event of the subform

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 46 Then
    KeyCode = 0
End If
End Sub

Open in new window


or this

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyDelete Then
    KeyCode = 0
End If
End Sub

Open in new window

0
 
LukeBAuthor Commented:
Hi MX, not can upload easlity, is an interface linked to a SQL backend

I will try a blank form and go from scratch and see if works. But for now I will try Cap's solution to get it going for users
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
No code s/b required ....

mx
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now