Access 2007 - Update TabIndex on Subform Fields on Update of Parent Form Field
Posted on 2012-03-28
I would like to be able to update the column display positions in a Subform (Report_Dtl_subform), based on the selection from a field (Fld_Rpt_Type) on the Parent form. So when, for example, "Activity" is chosen in Fld_Rpt_Type, the Activity column should appear in Column 2 (TabIndex = 1) on the Subform. The other two columns (Fld_Client_Name and Fld_Employee_Name) are moved to Col 3 and Col 4.
So to test , I added this code for Fld_Rpt_Type:
Private Sub Fld_Rpt_Type_AfterUpdate()
If Fld_Rpt_Type.Value = "Activity" Then
Form_Report_Dtl_subform.Fld_Activity_Name.TabIndex = 1
MsgBox ("Activity Name Tab = " & Form_Report_Dtl_subform.Fld_Activity_Name.TabIndex)
Form_Report_Dtl_subform.Fld_Client_Name.TabIndex = 2
Form_Report_Dtl_subform.Fld_Employee_Name.TabIndex = 3
And I refresh the Subform:
Private Sub Report_Dtl_subform_Enter()
When I select "Activity", the MsgBox returns "Activity Name Tab = 1", so it appears to be working. But of course, the columns don't change. And when I look at the Subform design, the TabIndex properties are not changed.
I also tried updating the Visible property to "No" for the columns that I did not want, but they remained visible.
Clearly I am missing something here. Or maybe what I am trying to do is just not possible?