Selasa, 04 Juni 2019

Re: [MS_AccessPros] Unwanted NumLock toggle

 

hi Steve,

Indeed, it does turn NumLock off, interesting. SendKeys is always a last resort ... however, short of using another date picker, if you are going to use SendKeys, then turn on NumLock too?

SendKeys "%{DOWN}{NumLock}"

btw, if you use Me.TestDate instead of Me!TestDate, the compiler will check it.

~~~

To avoid SendKeys, and have a more robust date picker, here is a popup calendar you can use:
http://www.rogersaccesslibrary.com/forum/popup-calendar-works-in-access-2007-lower-too_topic597.html

The code behind the form handles everything.?? I generally pop it up on the double-click event of a control ... but you could do as you are now, and use the GotFocus event to see if it needs to be filled and if so, pop it up -- and maybe do double-click too.

have an awesome day,
crystal

free code you can use in your projects
https://msaccessgurus.com/code.htm


On 6/4/2019 11:50 AM, Steve thaw5 thaw5@suddenlink.net [MS_Access_Professionals] wrote:
I found a snippet of code that I thought would be useful: When a form's text field which is formatted for date gets the focus, the snippet of code pops up the calendar by using the SendKeys function to send ALT DOWN. Here is the code:

Private Sub TestDate_GotFocus()
???? If Nz(Me!TestDate, "") = "" Then
?????????? SendKeys "%{DOWN}"
???? End If
End Sub


This works OK as far as popping up the calendar and is something I'd like to use. But . . . seems like there's always a but . . . the SendKeys also toggles NumLock. So if NumLock is ON when the TestDate field gets the focus, NumLock is toggled OFF. And vice versa.

My desktop computer is Windows 10, Office Professional 2016, LogiTech MK520 keyboard/mouse combo. The NumLock toggle is consistently repeatable.

I tried the same form on a Dell M4800 laptop, also Windows 10 and Office Professional 2016. NumLock does not toggle on this machine. So the NumLock toggle seems to be machine dependent.

Any ideas as to how to overcome the NumLock toggle on the desktop computer? Does the toggle have something to do with LogiTech keyboard?

Thanks.

Steve

__._,_.___

Posted by: crystal 8 <strive4peace2008@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

SPONSORED LINKS
.

__,_._,___

Tidak ada komentar:

Posting Komentar