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!

Preventing deletion (but not editing/addition) within field 1

Status
Not open for further replies.

pbbriggs

MIS
Jun 24, 2003
68
0
0
US
I wasn't sure whether to post here or in the Access Forms forum, but I have a suspicion that if this can be done at all, it will need to be done in code...

I have a form on which all fields are locked except one, which is a "notes" field (memo format). I want all users to be able to add notes to the field. However, once a note is added and the record saved, I want those existing notes to be protected. I'd like other users (or the same user) to be able to enter the record later and add subsequent notes to the same field (creating a cumulative memo field of notes), but I don't want anyone to be able to delete existing notes. I've read about creating separate tables with audit trails of changes/deletions, but this is really not what I'm looking for. I basically want to keep all of the notes in the field, but not allow anyone to (accidentally or intentionally) delete out existing notes to "revise history", so to speak. The memo field is not to be used for any data mining, etc., so I don't care if it gets messy because of users' inability to delete. It's simply a method of creating subjective status reports.

Any thoughts would be appreciated.
Thanks,
Patricia
 
My instinctive reaction is to provide a protected or locked control (text box, list box, Rich Text Box, whetever) that receives the current content of the Memo and another one that the user can add new note text. The application then does something like
[tt]
MemoField = MemoField & vbCrLf & txtNewMemo.Text
[/tt]
 
Aha! Of course. I knew there had to be something I wasn't considering. Haven't even tried it yet but I know you just gave me a great solution. Thanks for the (very speedy) reply. Here's a star, as I'm about to go do what you just suggested.
Patricia
 
Its a little tricky. I usually add a field of type Boolean to my table, call it something like NoMoreEditsFlag, and create a checkbox on the form based on it, set to invisible. When the record is finished being edited, I use the AfterUpdate event to set the checkbox to true. In the OnCurrent event of the form, I check for the value of the invisible flag. If it is true, I set the txtWhateverEditField.Locked to true. If it is false, I set locked to false.

 
vbajock,
Thanks for the reply! Sounds like a clever way to prevent any editing at all. Unfortunately, I need to allow edits/additions, just not deleting. I'm going to try what Golom suggested.
Thanks
Patricia
 
Why not use an independant textbox and appending its text property to the memo ?
You may have to consider the Len, Trim, Left and/or Mid functions.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top