Solved

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

Posted on 2011-03-16
4
575 Views
Last Modified: 2012-06-21
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
Comment
Question by:LukeB
  • 2
4 Comments
 
LVL 75

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
That should not be happening.  Something else is going on ...

Can you upload the db (sanitized) ?

mx
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
Comment Utility
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
 
LVL 1

Author Comment

by:LukeB
Comment Utility
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
 
LVL 75

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
No code s/b required ....

mx
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now