×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Moving to subform turns off NumLock

Moving to subform turns off NumLock

Moving to subform turns off NumLock

(OP)
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.

RE: Moving to subform turns off NumLock

Set a break point in your code and watch to see what line causes the numlock to turn off and post the results.

John A. Gilman
gms@uslink.net

RE: Moving to subform turns off NumLock

(OP)
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 "sub1"
    DoCmd.GoToControl "sub1"
    DoCmd.GoToRecord , , acLast
    DoCmd.GoToRecord , "", acNewRec
    ctlrRdng.SetFocus

End Sub

The "acLast" 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.

RE: Moving to subform turns off NumLock

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.

John A. Gilman
gms@uslink.net

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close