Access input masks and auto tab

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Frank Marsella
    New Member
    • Dec 2010
    • 7

    Access input masks and auto tab

    I have programmed several command buttons (0-9) on my form in order to input numbers into a textbox. I have placed a mask of six characters and activated the auto tab feature in the textbox properties dialog. When I input 6 characters from the keyboard the auto tab works. When I input 6 characters from the command buttons the auto tab does not work. I read in help that Access ignores input masks when characters are not typed directly into the control. Is there a work-around for such a situation?
  • colintis
    Contributor
    • Mar 2010
    • 255

    #2
    You can make add a line of code pointing to the auto tab event within the buttons, after placing the characters into that textbox. It should work as its pointing to activate the event.

    Comment

    • Frank Marsella
      New Member
      • Dec 2010
      • 7

      #3
      First let me make clear that I am a beginner in Access. I see the auto tab on the "Other" tab of the properties dialog with a yes/no response available. I do not see auto tab on the "Events" tab of the properties dialog where I could write code. Could you kindly provide more information on how and where this could be written, and if possible, an example.

      Comment

      • colintis
        Contributor
        • Mar 2010
        • 255

        #4
        Ok, so let me know if the codes you are putting in for the command buttons isn't VBA (The place where you write code for events in event tab).

        After the line of code where you add the character to the textbox, use the Len function to check the length of the characters in the textbox is 6. If its equals to 6, then use .SetFocus to the item you wished to select on, or use it to warn user not to continue the inputs. So the code would be like this:

        Code:
        Private Sub Command1_Click()
            '************
            'The codes where you append a character to the text box
            '************
        
            If Len(<name of your textbox>.Value) >= 6 Then
                'If you are going to points to something else
                <name of your next item>.SetFocus
            End If
        End Sub

        Comment

        • Frank Marsella
          New Member
          • Dec 2010
          • 7

          #5
          colintis,
          Your instruction and example proved very helpful. I've got the result I was looking for. Thanks so much!

          Comment

          Working...