P
Pasadena-D via AccessMonster.com
Hello,
I have a frmTaskList form that contains 3 subforms using tab controls. Each
tab has the following subforms:
SubForm Name: Form Name:
Task List Subform frmTask_List_Active_SubForm
Active Task OverDue frmTask_List_Active_OverDue_SubForm
New Task frmTask_List_Active_New_SubForm
On the frmTaskList I have a button that opens a frmEdit form. When frmEdit
opens I want it to contain the records of the one that was selected when the
user hit the button to open the frmEdit. The issue is that there are 3
subforms, and I don't know how to write the code to determin which subform it
came from. I have built code for each subform, and it works great, but I have
to have 3 buttons. I'd rather have just one button that does the job.
Here's the code that I use for each subform to make this work:
Task List Subform I use:
Private Sub cmdEdit_Click()
DoCmd.OpenForm "frmEdit", acNormal, "", "[Task_ID]=[Forms]![frmTask_List]!
[Task List Subform].[Form]![Task_ID]", , acNormal
End Sub
Active Task OverDue I use:
Private Sub cmdEdit_Click()
DoCmd.OpenForm "frmEdit", acNormal, "", "[Task_ID]=[Forms]![frmTask_List]!
[Active Task OverDue].[Form]![Task_ID]", , acNormal
End Sub
New Task I use:
Private Sub cmdEdit_Click()
DoCmd.OpenForm "frmEdit", acNormal, "", "[Task_ID]=[Forms]![frmTask_List]!
[New Task].[Form]![Task_ID]", , acNormal
End Sub
As you can see the code is exactly the same except the SubForm name changes
depending on which subform your on. Again, I'd like to have just one button
that does this form me, not 3 like I have now. Thanks in advance for your
help!
I have a frmTaskList form that contains 3 subforms using tab controls. Each
tab has the following subforms:
SubForm Name: Form Name:
Task List Subform frmTask_List_Active_SubForm
Active Task OverDue frmTask_List_Active_OverDue_SubForm
New Task frmTask_List_Active_New_SubForm
On the frmTaskList I have a button that opens a frmEdit form. When frmEdit
opens I want it to contain the records of the one that was selected when the
user hit the button to open the frmEdit. The issue is that there are 3
subforms, and I don't know how to write the code to determin which subform it
came from. I have built code for each subform, and it works great, but I have
to have 3 buttons. I'd rather have just one button that does the job.
Here's the code that I use for each subform to make this work:
Task List Subform I use:
Private Sub cmdEdit_Click()
DoCmd.OpenForm "frmEdit", acNormal, "", "[Task_ID]=[Forms]![frmTask_List]!
[Task List Subform].[Form]![Task_ID]", , acNormal
End Sub
Active Task OverDue I use:
Private Sub cmdEdit_Click()
DoCmd.OpenForm "frmEdit", acNormal, "", "[Task_ID]=[Forms]![frmTask_List]!
[Active Task OverDue].[Form]![Task_ID]", , acNormal
End Sub
New Task I use:
Private Sub cmdEdit_Click()
DoCmd.OpenForm "frmEdit", acNormal, "", "[Task_ID]=[Forms]![frmTask_List]!
[New Task].[Form]![Task_ID]", , acNormal
End Sub
As you can see the code is exactly the same except the SubForm name changes
depending on which subform your on. Again, I'd like to have just one button
that does this form me, not 3 like I have now. Thanks in advance for your
help!