Hello,
I have 12 subforms and i used the code below as a pointer to refer to the subform "tblTitle01 subform'". It works great but it is not dynamic. Can somebody please help me how to make this dynamic so when i click the field in tblTitle02 it will point back to the same field after the docmd.close.
Thank you
'name of subform
tblTitle01 subform
tblTitle02 subform
tblTitle03 subform
etc,
tblTitle12 subform
i tried to do like this but it's a type mismatch error
I have 12 subforms and i used the code below as a pointer to refer to the subform "tblTitle01 subform'". It works great but it is not dynamic. Can somebody please help me how to make this dynamic so when i click the field in tblTitle02 it will point back to the same field after the docmd.close.
Thank you
'name of subform
tblTitle01 subform
tblTitle02 subform
tblTitle03 subform
etc,
tblTitle12 subform
Code:
Private Sub JobTitle_DblClick(Cancel As Integer)
Forms![ProjectDetails].Form.[tblTitle01 subform].Form.[tblEstimation subform].Form.JobTitleID = Me.JobTitle
Forms![ProjectDetails].Form.[tblTitle01 subform].Form.[tblEstimation subform].Form.JobTitleID.SetFocus
DoCmd.Close acForm, "Job Titles"
End Sub
i tried to do like this but it's a type mismatch error
Code:
Private Sub JobTitle_DblClick(Cancel As Integer)
Dim myForm As Form
Set myForm = Screen.ActiveForm.ActiveControl.Form.Name
Forms![ProjectDetails].Form.myForm.Form.[tblEstimation subform].Form.JobTitleID = Me.JobTitle
Forms![ProjectDetails].Form.myForm.Form.[tblEstimation subform].Form.JobTitleID.SetFocus
DoCmd.Close acForm, "Job Titles"
End Sub