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

Stop user from deleteing values in text box

Status
Not open for further replies.

grmman

MIS
Sep 9, 2003
81
US
I have a text box on a form its control source is a memo field from my table.
I need the user to add info into the text box, but I don't want them to be able to delete any of the data that is there already.

Thanks for the help.
G


 
In the BeforeUpdate event procedure check the Value against the OldValue:
If Left(yourTextBox, Len(yourTextBox.OldValue)) <> yourTextBox.OldValue Then
MsgBox "your message"
Cancel = True
Exit Sub
End If

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Don't think you can do that -- exactly. Once you give a user access to edit the data in the text box, they will be able to add/delete/change it.

So, try a work-around. Keep your memo field text box locked and create another text box that you allow the user to edit. You should be able to make them look like one large text box on the screen. At whatever point you would normally save the data, concatenate the two -- me.textbox1 = me.textbox1 & " " & me.textbox2.


Randy
 
I worked a little slower than randy700, but I'll post this anyway.

Probably the easiest way to do this is to use 2 fields. One field would display the existing memo field data and should be disabled or at least locked. The other field would be an unbound field where the user makes his entry. In the process of updating the form, the unbound field would then be appended (via code) to the existing memo field.

One thing to be aware of, is that an unbound field does not "dirty" the form and therefore will not trigger an update event. You will have to create a positive means of saving the record changes such as adding a "Save Record" button and procedure. This has a secondary benefit in that the user can verify his entry before saving as he will not be able to edit it after the fact.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top