Hi All,
I have a form that contains two subforms.
I want the user to be able to double click a field in subform 1 and have it send textbox values to fields in subform 2.
I wrote the code below but it's not working correctly. It captures the global variables and sets the focus to subform2 but doesn't transfer the variable values to the TaskId and YEAR fields in subform2.
I have a form that contains two subforms.
I want the user to be able to double click a field in subform 1 and have it send textbox values to fields in subform 2.
I wrote the code below but it's not working correctly. It captures the global variables and sets the focus to subform2 but doesn't transfer the variable values to the TaskId and YEAR fields in subform2.
Code:
Private Sub ID_DblClick(Cancel As Integer)
'Capture ID and Year in global variables
pv_Task_Id = Me.ID
pv_Task_Year = Me.YEAR
'When the user double clicks the ID field in subform1 move the focus to subform2 and enter a new record
Parent![Frm_Exceptions_subform].SetFocus
DoCmd.GoToRecord , , acNewRec
'Send values captured from subform1 (ID, YEAR) and enter those in subform2 as a new record
Me![Frm_Exceptions_subform].Form!Task_id.SetFocus
Task_id = pv_Task_Id
Me![Frm_Exceptions_subform].Form!Task_Year.SetFocus
Task_Year = pv_Task_Year
End Sub