Num Lock disabled after click event

M

Mary

My Num lock is disabled after an On Click Event macro runs. I converted the
macro to vb to show the code:

Function CancelProject()
On Error GoTo CancelProject_Err

DoCmd.Close acForm, "ExistingProject"
SendKeys "{ESC}", False
SendKeys "{ESC}", False
SendKeys "{ENTER}", False
DoCmd.Close acForm, "Auto_Enter New Task"
DoCmd.Maximize


CancelProject_Exit:
Exit Function

CancelProject_Err:
MsgBox Error$
Resume CancelProject_Exit

End Function

The Sendkeys ESC commands are to clear the fields and the main form, Enter
is to click Yes to close that form. It all works the way I expected, but as
soon as I click the button, the Num lock is turned off. Can anyone tell me
why, and can this be changed so it stays on?

Thanks! Mary
 
6

'69 Camaro

Hi, Mary.
My Num lock is disabled after an On Click Event macro runs.

This is a known bug in the SendKeys function. SendKeys isn't that reliable
and can usually be replaced with VBA code. It appears from your code below
that the intent is to close the "ExistingProject" form, undo changes in the
record on the active form (perhaps "Auto_Enter New Task"?), close the
"Auto_Enter New Task" and maximize whatever form is now active. If not,
please explain what needs to be done, and we can probably help you with the
code so that you don't need to use a macro with SendKeys.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)

- - -
When you see correct answers to your question posted in Microsoft's Online
Community, please sign in to the Community and mark these posts as "Answers,"
so that all may benefit by filtering on "Answered questions" and quickly
finding the right answers to similar questions. Remember that questions
answered the quickest are often from those who have a history of rewarding
the contributors who have taken the time to answer questions correctly.
 
M

Mary

Gunny, that is exactly what I'm trying to do. I'll take a look at the links
you provided, but if there's an easy fix, please post back. Thanks! Mary
 

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