I know this topic has been addressed plenty of time and I tried almost every methods discussed on this topic. But for some reason, I am not able to set focus on the control in the subform.
The name of my main form is frmLeaveRequest_Add and the name of my subform is TimeCharged
On the before update event of the main form, I have validation to ensure that data is filled in the subform.
It gives the appropriate message if the data is not entered on the subform. After the message I try to set focus to the control. That part is not working. Given below are the various methods I tried and none of them worked. Could someone direct me in the right direction.
1. Me!TimeCharged.Form!TimeChargeCode.SetFocus
2.
[Forms]![frmLeaveRequest_Add].[TimeCharged].SetFocus
[Forms]![frmLeaveRequest_Add].[TimeCharged].[Form].[TimeChargeCode].SetFocus
3.
Me![TimeCharged].SetFocus
Me![TimeCharged].Form![TimeChargeCode].SetFocus
The name of my main form is frmLeaveRequest_Add and the name of my subform is TimeCharged
On the before update event of the main form, I have validation to ensure that data is filled in the subform.
It gives the appropriate message if the data is not entered on the subform. After the message I try to set focus to the control. That part is not working. Given below are the various methods I tried and none of them worked. Could someone direct me in the right direction.
1. Me!TimeCharged.Form!TimeChargeCode.SetFocus
2.
[Forms]![frmLeaveRequest_Add].[TimeCharged].SetFocus
[Forms]![frmLeaveRequest_Add].[TimeCharged].[Form].[TimeChargeCode].SetFocus
3.
Me![TimeCharged].SetFocus
Me![TimeCharged].Form![TimeChargeCode].SetFocus
Last edited: