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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Allow edits/changes but not deletes?

Status
Not open for further replies.

thefourthwall

IS-IT--Management
Feb 26, 2002
387
US
A form for displaying users' information allows deletes of some field's values; this was an oversight I want to correct today.
I want to prevent database operators from deleting values like cell phone numbers, thus leaving that field with a null value, while allowing the number to be changed if necessary.
In looking for a solution I found TheAceMan1's solution in [link javascript:eek:penindex(450,450,']thread702-1540102[/url]. Can this thinking be applied to just one field, or is there another way?

Thanks,
thefourthwall
 
You want the Before Update event of the control for the field.

You want to "cancel" the event if a value is deleted by setting the cancel variable to true.

Also look into the Oldvalue property.

If you need more help, just post back.
 
Edit (mor or less) implies delete. You can, as noted, check hte before update results; compare old value ... BUT in the end, allowing edits will always permit the determined or just careless user to corrupt the data to the point that it may as well be / have been deleted.


MichaelRed


 
Considering MichaelRed's comments, you might want to consider adding a validation rule to the mix to further limit the input.
 
Thanks to you both for the ideas. lameid, that sure makes sense and i came to think that validation might be the best way. But i need help with validation - i've never used it before and am not clear on how to... the field contains a phone number with no input mask, just a 10-digit string. Is there a best way to validate that a 10-digit numerical string remains in the field? thanks.
 
I haven't used validation rules often so I am guessing a little at syntax but the like operator comes to mind for 10 digits...

Code:
Like "##########"

The validation Rule will trigger when a record is created so you need to allow for the blank value too...


Code:
Like "##########" Or Is Null
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top