Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving to subform turns off NumLock

Status
Not open for further replies.

aliendan

Programmer
Jun 28, 2000
79
0
0
US
Here's one for somebody. This is a project I built two years ago and never found a solution. On the main form there's a list box named "lact" and when an item is selected in the list box the curser is moved to a location on the subform named "sub1". The problem is that during the move the NumLock turns off and if one (like me) wants to use the number pad to enter data the NumLock needs to be manually turned back on each time. Below is the code I used back then to make this happen. (It's funny sometimes to look back and see how you did things in the past.) Any solutions to the NumLock problem from anyone?

Private Sub lact_AfterUpdate()
DoCmd.Requery "sub1"
DoCmd.GoToControl "sub1"
DoCmd.GoToRecord , "", acLast
SendKeys "~", False
SendKeys "~", False
SendKeys "~", False
End Sub

This database was built in Access 97. [sig][/sig]
 
Set a break point in your code and watch to see what line causes the numlock to turn off and post the results. [sig]<p>John A. Gilman<br><a href=mailto:gms@uslink.net>gms@uslink.net</a><br>[/sig]
 
Now why didn't I think of that...heheahaha. In doing so the first Sendkeys turned it off, the second turned it back on and the third turned it off again. Sheesh. I re-wrote it like this:

Private Sub lact_AfterUpdate()
Dim ctlrRdng As Control

Set ctlrRdng = Forms![frmDlyProdRdngs]![sub1].Form![rRdng]

DoCmd.Requery &quot;sub1&quot;
DoCmd.GoToControl &quot;sub1&quot;
DoCmd.GoToRecord , , acLast
DoCmd.GoToRecord , &quot;&quot;, acNewRec
ctlrRdng.SetFocus

End Sub

The &quot;acLast&quot; allows me to view the previous days reading as I input the new reading. That's why I had the three Sendkeys in there. Glad I don't do things like that anymore. :) Thanks for waking my up...I've been sleeping a lot lately with my eyes wide open. With the new code it doesn't turn off the NumLock. [sig][/sig]
 
sometimes we sweat the small stuff and get all upset. I thank YOU for the reply. It makes it worthwhile posting what I think might be a helpful answer only to have the person who posted the question get all irated because they eighter did not understand you or God forbid you posted a wrong solution.

Keep on keepin on. [sig]<p>John A. Gilman<br><a href=mailto:gms@uslink.net>gms@uslink.net</a><br>[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top