Forms

3.3 A Better Input Mask Solution.
  Tim Jones, Nextel Communications of Houston, Texas US.
As we all know, clicking on a control with an input mask usually places the cursor directly underneath where you clicked, which is usually not at the beginning of the field. I have put together a function that not only moves the cursor to the beginning, but is also useful for modifying existing data in the input mask. The first time you click on a control with the input mask, the cursor gets placed at the beginning of the control. As long as you don't click on another input masked control, each subsequent time you click on that control, the cursor moves directly to where you click (Normal input mask behavior). For example, to modify the last two digits in a phone number input mask, you wouldn't have to hit any keys to navigate to those numbers. You could just click the control again after the first time and instantly be in the correct location.

*** Place code below in a module ***
Public Static Function MoveToBeg(Ctrl As Control)
   Dim PrevControl As String
   With Ctrl
      'Is this the same control as last time?
      If PrevControl <> .Name Then
         'A new input masked control was clicked
         'Reset value of PrevControl to this control
         PrevControl = .Name
         .SelStart = 0
      End If
   End With
End Function
*** To activate, insert line below into each input masked control's OnClick property:
   =MoveToBeg([Screen].[ActiveControl])
This works on MS Access 97.


Se pensate di avere del materiale freeware interessante e volete pubblicarlo, allora leggete qui.