Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Users Deleting Data 1

Status
Not open for further replies.

Triedit

Technical User
Mar 9, 2001
28
GB
Is there any code I can use to stop users inadvertently deleting data
 
You can intercept the CTL-Delete key combination. I often do this and replace the function with a Delete button. Here is the code, which goes in the Action method of your MRU or edit field.

if eventInfo.id() = DataDeleteRecord and self.isEdit():
then msgStop("Forbidden:", "You cannot delete records once they have been generated.")
eventInfo.setErrorCode(UserError)
endif

***

OR, you can trap for the Delete key in the Keyphysical event of the form and handle it that way. The code is:

if eventInfo.isPreFilter() then
;// This code executes for each object on the form
if eventInfo.vCharCode() = VK_DELETE
then disableDefault
endif
else
;// This code executes only for the form

endIf


The second instance won't prevent them from backspacing out characters, but you can trap for that too. It will make editing hell, however.

Mac :)

"Do not delve too deeply in the arts of your enemy and so become ensnared by them"

langley_mckelvy@cd4.co.harris.tx.us
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top