Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SetFocus from MainForm to SubForm 1

Status
Not open for further replies.

jamaarneen

Programmer
Dec 27, 2007
213
BE

Hi,

How do set focus from a control's event in the MainForm, to a specific control in the subForm?

I tried this, but no result.
Code:
Me.[i]subFormName[/i].Form![i]ControlName[/i].SetFocus

Any suggestion why?

Thanks

 
You have to do this in two stages, first set focus to the subform control, then use the line you have, that is:

Me.subFormName.SetFocus
Me.subFormName.Form!ControlName.SetFocus
 

Hi Remou,
Thanks A lot. thiis made me more clear.

But I still have a problem...

My MainForm has a Calender 'ActiveX control', from where I want to set focus to the SubForm.

I have put the code in the calender's 'AfterUpdate' event.
When I click down on the Calender, I see for a second that the desired control in the SubForm has got Focus, but then it disapears...

I think that the cause might be, because the 'AfterUpdate' event fires while the mouse is still down on the calender, and therefor the focus must return to the calender.

I would try to put the code in a 'MouseUp' event, but I don't see any 'MouseUp' event for the calender control...

(by the way, in the 'AfterUpdate' event, I also assign a value to the control in the SubForm.)

Thanks in advanced,
Ja
 
Thanks a lot Remou,

I tried the OnClick event and it WORKED!!! [thumbsup]
I would never imagine that the 'On Click' event is firing after I actually release the mouse...

but 'Access-Logic' isn't always 'Human-Logic'...

Ja
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top