Disappearing text

Sprocket

Registered User.
Local time
Today, 23:05
Joined
Mar 15, 2002
Messages
70
I have a form that has a memo field. If text in the memo field is highlighted and I press the enter key the text is deleted.

Does anyone know how to prevent this from happening?

I know it is easy enough to click off the text (deselect it) so that pressing the enter key will move me to the next field (as required) but I don't always remember to do this and Hey Presto I've lost my text and have to start again.

But why highlight the text in the first place I hear you say. Well I have just pasted it in from a different application and it comes in highlighted.
 
hi.
perhaps adjusting this will help?:
tools/options/keyboard/behaviour entering field

also check the 'Enter Key Behaviour' on the 'Other' tab of the properties of the field. maybe adjusting that will help.
w
 
Thanks for the suggestion - setting the 'Enter Key Behaviour' on the 'Other' tab of the properties of the field to Default rather than Next Line prevents immediate deletion but highlights the entire content of the field. Not so bad - except if you then happen to press the Escape key everything is deleted.

Boy is this database dangerous. :eek:

If it was a stand-alone database with just a single user (me) this might not be so bad but it is a multi-user database on a shared drive and thus needs to be somewhat more robust.

Line up the options people I will try anything.

Ta....... (English colloquialism for thanks.)

PS. the same thing happens in MS Word by the way but does NOT happen in Excel. Hows that for consistency!!
 
Last edited:
You could use something along the lines of....

Code:
Private Sub YourMemoField_KeyDown(KeyCode As Integer, Shift As Integer)
    
    Select Case KeyCode
        
        Case vbKeyReturn
            MsgBox "You Pressed Return"
            Me.AnotherControl.Setfocus
            
        Case vbKeyEscape
            MsgBox "You Pressed Escape"
            Me.AnotherControl.Setfocus

    End Select

End Sub
 
Last edited:
Oh... thats good!!

And so simple.

Fits the bill perfectly.

Ta. :D
 

Users who are viewing this thread

Back
Top Bottom