clicking on button in form from subform (1 Viewer)

Wysy

Registered User.
Local time
Today, 08:16
Joined
Jul 5, 2015
Messages
291
Hi,
I am trying to solve the following problem:
Object is a form/subform one. The header of the form has command button. If the focus is on the subform for entering data and i want to click the command button in the parent form, i need to click twice. I suppose once to move the focus from subform to form's header, then again to run the code behind the button. Is there a way to achive this by clicking only once?
thanks
 

Ranman256

Well-known member
Local time
Today, 11:16
Joined
Apr 9, 2015
Messages
4,102
clicking once should run btn_click event,
but what events are running behind the click ?
 

Wysy

Registered User.
Local time
Today, 08:16
Joined
Jul 5, 2015
Messages
291
it does not, two click is necessary to run btn_click event. It should open a form.
 

mike60smart

Registered User.
Local time
Today, 16:16
Joined
Aug 6, 2017
Messages
1,178
Try the following in the AfterUpdate Event of a Control on your Subform:-

Me.[MainFormName].SetFocus ‘Sets focus to the Form
Me.[MainForm].Form!NameOfButton.SetFocus

Then click the Button
 

Users who are viewing this thread

Top Bottom