Solved

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

Posted on 2011-03-16
4
579 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

733 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