How to Activate Input Mask When Tabbing into Control

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mtgrizzly52
    New Member
    • Dec 2006
    • 14

    How to Activate Input Mask When Tabbing into Control

    First thing, because of you all and this web site, I am building a first class time saving database for my fellow workers to use.

    My really dumb questions is this.

    I have a control in a subform that is in the second position in terms of all the controls in the form. When entering the subform via a toggle button, the focus is set on the first control which is locomotiveID. (By the way, the subform is a datasheet type of subform)

    The number 2 control is called TimeObserved and I have included an input mask of short time in the data portion of the property box for this control. I want the input to be in military time. If I tab from the LocomotiveID control to the TimeObserved control, the input cursor is basically a text entry type of cursor. If I click in the TimeObserved control when I leave the LocomotiveID control, then the input mask setup _ _:_ _ is visible and the cursor is set to take the proper input.

    I really need to have the input mask setup with the cursor in the proper position set up when I tab from the first control to the second one, but everything I've tried will not work. I'm tried to setfocus in several different ways using the GetFocus event and the same thing with the LostFocus event associated with LocomotiveId Control. Nothing will work short of just clicking in the control's text box. I'm sure the solution is very simple, but I can't figure it out.

    Can anyone lead me to the Promise Land on this one? If I can whip this problem, then I'm going to start beta testing the database, so...HELP! *LOL*

    Thanks all!

    Rick Flink = The Grizz
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    Hi Rick,

    I have not used input masks very much as I do not really like them. I have tested this and you are right it will not appear when you tab into the control. I have no idea if there is a fix for it.

    Mary

    Comment

    • mtgrizzly52
      New Member
      • Dec 2006
      • 14

      #3
      Thanks Mary,

      As I said this was a really dumb question because all of sudden, after I sent this request for help, it started to work properly. Don't ask me why???? Magic or maybe I have the gifted hand with weird issues. *LOL*.

      Anyway, I appreciate the fact you tried to help me out with this one. Life is good now, and I can get to doing my Randy test on it....kind of like a Bubba test, but specific to my work group. If Randy can make it work, anyone can make it work.

      Thanks again and have a fantastic rest of the day!

      Rick

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        Originally posted by mtgrizzly52
        First thing, because of you all and this web site, I am building a first class time saving database for my fellow workers to use.

        My really dumb questions is this.

        I have a control in a subform that is in the second position in terms of all the controls in the form. When entering the subform via a toggle button, the focus is set on the first control which is locomotiveID. (By the way, the subform is a datasheet type of subform)

        The number 2 control is called TimeObserved and I have included an input mask of short time in the data portion of the property box for this control. I want the input to be in military time. If I tab from the LocomotiveID control to the TimeObserved control, the input cursor is basically a text entry type of cursor. If I click in the TimeObserved control when I leave the LocomotiveID control, then the input mask setup _ _:_ _ is visible and the cursor is set to take the proper input.

        I really need to have the input mask setup with the cursor in the proper position set up when I tab from the first control to the second one, but everything I've tried will not work. I'm tried to setfocus in several different ways using the GetFocus event and the same thing with the LostFocus event associated with LocomotiveId Control. Nothing will work short of just clicking in the control's text box. I'm sure the solution is very simple, but I can't figure it out.

        Can anyone lead me to the Promise Land on this one? If I can whip this problem, then I'm going to start beta testing the database, so...HELP! *LOL*

        Thanks all!

        Rick Flink = The Grizz
        To have the Input Mask automatically set up, and the Cursor in the proper position, in the GotFocus Event of the [TimeObserved] Field place the following single line of code:
        Code:
        Private Sub TimeObserved_GotFocus()
          SendKeys "{F2}"
        End Sub

        Comment

        • mtgrizzly52
          New Member
          • Dec 2006
          • 14

          #5
          ADezii,

          You are a genius! Now things are working perfectly! Thanks so much for the help on this....Now that I've used your suggestion, I need to do my homework, and figure out what it means for future similar situations.

          Thanks again!

          Rick

          Comment

          • ADezii
            Recognized Expert Expert
            • Apr 2006
            • 8834

            #6
            Originally posted by mtgrizzly52
            ADezii,

            You are a genius! Now things are working perfectly! Thanks so much for the help on this....Now that I've used your suggestion, I need to do my homework, and figure out what it means for future similar situations.

            Thanks again!

            Rick
            We're always glad to help at thescripts.

            Comment

            Working...