Solved

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

Posted on 2011-03-16
4
576 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
ID: 35152168
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
ID: 35152174
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
ID: 35152261
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
ID: 35152282
No code s/b required ....

mx
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Error in query expression 3 37
Newbie needs help printing from a form. 10 20
Problem with syntax with TransferDatabase 3 15
Query design issue 2 24
This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
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…

867 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

22 Experts available now in Live!

Get 1:1 Help Now