>news:f5hn2t$18kg$1@textnews.wanadoo.nl...
Quote:
>>Thanks,
>>>
>>Forms!formb.setfocus works fine.
>>>
>>The problem now is that the name of the form is looked up in a table, so
>>I have it in a string value. I tried every possible reference without
>>luck:
>>>
>>Forms!strMyString.setfocus
>>Forms(strMyString).setfocus
>>Forms![strMyString].setfocus
>>>
>>What am I doing wrong???
>>john
>>>
>>>
>>>
>>"ARC" <andy@andyc.comschreef in bericht
>>news:EoYei.21468$C96.4280@newssvr23.news.prodigy .net...
>>>In the button that opens form b, you might want to put 2 set focus
>>>commands:
>>>>
>>>Forms!formb.setfocus
>>>forms!formb.form![ctrlname].setfocus
>>>>
>>>>
>>>>
>>>"John" <jo@hn.comwrote in message
>>>news:f5hjfg$17ck$1@textnews.wanadoo.nl...
>>>>Following code belongs to the first field in form B. When I open form
>>>>B from form A, ctl.Name returns the name of Form's A button which I
>>>>just clicked. How does this work? I thought when the field got focus
>>>>that would be the active control. How can I solve it so that it will
>>>>return the name of the field the code is in?
>>>>>
>>>>Private Sub MyFirstField_GotFocus()
>>>>>
>>>>Dim ctl As Control
>>>>Set ctl = Screen.ActiveControl
>>>>InfoField = ctl.Name
>>>>>
>>>>End Sub
>>>>>
>>>>Thanks,
>>>>john
>>>>>
>>>>
>>>>
>>>
>>>