Invalid Character Msg when using SendKeys

I am using a drop downlist where the user enters a birthdate.  If the birthdate is not in the list, I would like to use sendkeys "{esc}" in the not in list event.  I am getting the message "invalid character".  Could anyone let me know what I am doing wrong?  Thanks
WinnebagoAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
gwgawConnect With a Mentor Commented:
Or try this...

Private Sub MyControl_NotInList(NewData As String, Response As Integer)
Response = acDataErrDisplay
MyControl.Undo
End Sub
0
 
James ElliottManaging DirectorCommented:
Try using

sendkeys "{ESC}" ,true

Thanks

Jell
0
 
Richie_SimonettiIT OperationsCommented:
Why don't you try setting focus to next control?
0
 
WinnebagoAuthor Commented:
I couldn't get the other solutions to work, so I did something similar to your solution:

If MsgBox("No matches were found for the date you entered.", vbOKOnly) = vbOK Then
            Response = acDataErrContinue
        ctl.Undo
End If

Thanks for your help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.