Need VBA Code for the Escape Command

G

Guest

I have a form in which I want to type information in one field (e.g. field
one) and once I click on a command button, I want it to add the information I
just typed to the end of another field (e.g. field two) and then clear this
field (e.g. field one). I used some VBA code I found on this site to assist
in doing most of what I want. I can write a little code, but I'm still a
novice. My problem is after I click the command button, it doesn't clear
field one. If I'm in field one, type my text, then click on the command
button, once it appends to field two, my focus is in field one. I can
manually hit the escape key and field one clears. Perhaps if I could just
get the code to add the escape key at the end, this may solve my problem.

Any assistance would be greatly appreciated. My code is as follows:


Private Sub cmdMailTicket_Click()

'Sub cmdAppendToMemo()
Dim blnEnableEdits As Boolean

'---Enable edits
blnEnableEdits = Truea
Me.Contents.Locked = Not blnEnableEdits
Me.Contents.Enabled = blnEnableEdits

'--Commit edits to "log" field.
Me.Contents = Me.Contents & vbCrLf & Now() & vbCrLf & Me.WorkCompleted

'--Disable edits

blnEnableEdits = False
Me.Contents.Locked = Not blnEnableEdits
Me.Contents.Enabled = blnEnableEdits

WorkCompleted.SetFocus
' Perhaps adding the code for an escape key may do the trick, but I don't
know the code for the escape key.

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top