Control setfocus (1 Viewer)

cpampas

Registered User.
Local time
Today, 02:36
Joined
Jul 23, 2012
Messages
218
When I click on a command button in the main form, I want to move the focus to a combobox control in my subform. the focus shifts to the correct control and the combobox dropsdown
if I then choose one of the options of the control it also works correctly, but if instead I choose to type, the control wont accept any characters.


Code:
  Me![frmDetalheMovFinanc].Form![ContaID].SetFocus
  Me![frmDetalheMovFinanc].Form![ContaID].SelStart = 0
  Me![frmDetalheMovFinanc].Form![ContaID].Dropdown

Any Thoughts ?
 

cpampas

Registered User.
Local time
Today, 02:36
Joined
Jul 23, 2012
Messages
218
The Locked property is set to NO

if I add one more line to the code

Code:
Me![frmDetalheMovFinanc].Form![ContaID].SetFocus
  Me![frmDetalheMovFinanc].Form![ContaID].SelStart = 0
  Me![frmDetalheMovFinanc].Form![ContaID].Dropdown
 MsgBox (Screen.ActiveControl.Name)

the MsgBox returns the name of the button , shouldnt the active control be ContaID, in the subForm as the setfocus has already been executed ?
 

bob fitz

AWF VIP
Local time
Today, 10:36
Joined
May 23, 2011
Messages
4,727
try setting the focus to the form before setting it to a control
 

Users who are viewing this thread

Top Bottom