Removing a value from a text field

kleaves

Registered User.
Local time
Today, 09:36
Joined
Nov 21, 2006
Messages
25
I have a form with a unbound text field which when a user inserts text and then removes the focus from that field, the text gets inserted into a memo field. By using:

Me.[NOTES] = Now() & " " & Environ("UserName") & " - " & Text27365 & vbCrLf & Me.[NOTES]

However, I have noticed an issue with this, in respect that when the user enter text then moves to the next record, the previous entered text is still there, This could then cause this old text to get inserted into the wrong record. How can I set this field to blank once it I have moved to the next record or closed the form?
 
You should be using the AfterUpdate event of the Text27365 textbox to update the Memo field. You can clear the Text27365 textbox right after you update the Memo field. Me.Text27365 = ""
 
So are you saying that on the TEXTBOX I can still have the OnLostFocus event, which updates the NOTES memo field.

then also on the Textbox properties on AfterUpdate set the Event Procedure:

Me.Text27365 = ""

I tried that and now what happens is that, I open the form, the text field for the current notes are blank (this is as expected)
I enter "TEST TEST TEST" and click elsewhere, but instead of "TEST TEST TEST" being entered into NOTES I am now getting a blank row entered into my NOTES memo field
 
The OnLostFocus event occurs *every* time the control looses focus. The AfterUpdate event *only* occurs when the user has modified the control. I would move all of your code to the AfterUpdate event of the TextBox and leave nothing in the LostFocus event.
 
RG

Thanks all code now moved to After Update and it works like a dream. T
Thanks for that. Its very much appreciated

Kleaves
 

Users who are viewing this thread

Back
Top Bottom