How to set focus to text box on subform if name of the control if public var.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • FelixS
    New Member
    • Feb 2009
    • 16

    How to set focus to text box on subform if name of the control if public var.

    Situation: A form is opened containing subform, contents of subform is changing dynamically on form Open. I would like to have the first text box of subform under focus. Before opening, the name of the control is assigned to pubFirstControl variable.
    So far I could not find the way to solve this problem.
    Any hints?
  • FelixS
    New Member
    • Feb 2009
    • 16

    #2
    Solving the same problem I have encountered the following next one:
    I can set focus using statement

    Forms![F20]![FormSec].SetFocus

    However, at each moment the name of the form opened (F20 in the example above) is stored in variable PubCurForm. But i have not found any reasonable way to use the above statement with variable in place of Form name.
    Code like

    Select PubCurForm
    case "F20" Forms![F20]![FormSec].SetFocus
    ....

    is not an elegant solution.

    Who knows better way?

    Comment

    Working...