Question : NumLoc function is turned off when VB command to search any part of field is used

Hi Experts,

I found the following code in EE to have the standard Windows search window would default to ‘any part of field’ and added it to a command button. The problem is that when we click on the button to search through the records the NumLoc is turned off on the number keypad.

    Screen.PreviousControl.SetFocus    ' *** add this
    SendKeys "%ha%n"
    RunCommand acCmdFind

Is there anything we can do to prevent this from happening?

Thanks for your help!  :)

Answer : NumLoc function is turned off when VB command to search any part of field is used

The problems with SendKeys is that the intended target application Window must be the Active window at the time the SendKeys command is executed.  If it isn't, then SendKeys will fail.  Thus the issue with SendKeys is that the programmer must control the timing of the execution of  the SendKeys function.  there are at least two ways to structure your code to avoid problems.........see the various code examples in this link:
                               http://technet.microsoft.com/en-us/library/ee156592.aspx
Random Solutions  
 
programming4us programming4us