Control setfocus

cpampas

Registered User.
Local time
Today, 15:29
Joined
Jul 23, 2012
Messages
221
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 ?
 
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 ?
 
try setting the focus to the form before setting it to a control
 

Users who are viewing this thread

Back
Top Bottom