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.


keypad on form for entering data - not working with subform

keypad on form for entering data - not working with subform

I am trying to create a number keypad on a form that the end user can use to enter data. The end user will be using a tablet while walking in a department and entering data. The below vb code works but does not work when the end user needs to enter data into a sub form on a tab control. A text box on a tab control works, but not the subform. The error msg is RunTime error 2465: MS office cannot find the field 'Text1' referred to in your expression. It works in the form and tab control just not in the subform. What am I missing?

Private Function TypeAlphaNum(strKey As String) As String
Me.Controls(Screen.ActiveControl.Name).SelStart = Nz(Len(Me.Controls(Screen.ActiveControl.Name)), 0)
Me.Controls(Screen.ActiveControl.Name).SelLength = 0
Me.Controls(Screen.ActiveControl.Name).Value = Me.Controls(Screen.ActiveControl.Name).Value & strKey
End Function

'this code is used in the number 1 command button
Private Sub cmd1_Click()
TypeAlphaNum "1"
End Sub

RE: keypad on form for entering data - not working with subform

Subforms need to be referred to by name.
TextBoxName could also be a function but then it would be .[TextBoxName]

I hope that helps.

RE: keypad on form for entering data - not working with subform

Thank you for your reply but I'm looking for a generic way to do this since I'm unable to hard code every single control...this is why I'm using .activecontrol

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!


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