I have an unbound form called MainMenu that I use for a Main Menu.
Down the left side I have labels that correspond to different forms. Next to these I have an unbound subform named Child2.
When a user clicks on a label, the sourcobject of Child2 changes to the corresponding form name and that form appears in the subform. And the label backcolor turns white.
Currently there are 13 labels. I have achieved the above with some cumberson and long-winded code which will be difficult to edit when I need to add/change/delete labels.
Below is a sample (just one of the labels) that I use to change the child2's sourceobject:
Private Sub Import_Click()
Me.Child2.SourceObject = "ProfitLossImport"
Call allprocesses (calls function that changes backcolor)
End Sub
I have this attached to each labels ON CLICK event.
The code that changes the backcolor looks like this for each label:
Sub HighlightLabels()
If Me.Child2.SourceObject = "ProfitLossImport" Then
Me.Import.BackColor = 16777215
Me.Accruals.BackColor = 12632256
Me.UndoImp.BackColor = 12632256
Me.ZipFiles.BackColor = 12632256
Me.BuiltInReport.BackColor = 12632256
Me.CustomReport.BackColor = 12632256
Me.ExceptionReport.BackColor = 12632256
Me.CM2Report.BackColor = 12632256
Me.ImportTable.BackColor = 12632256
Me.AggregateTable.BackColor = 12632256
Me.ChartofAccountTable.BackColor = 12632256
Me.ProfitCenterTable.BackColor = 12632256
Me.YearTable.BackColor = 12632256
______________________________________________________
I tried using (CurrentControl = screen.activecontrol
Child2.sourcobject = CurrentControl) concept but I don't think labels can be in an active state? Please help!
Down the left side I have labels that correspond to different forms. Next to these I have an unbound subform named Child2.
When a user clicks on a label, the sourcobject of Child2 changes to the corresponding form name and that form appears in the subform. And the label backcolor turns white.
Currently there are 13 labels. I have achieved the above with some cumberson and long-winded code which will be difficult to edit when I need to add/change/delete labels.
Below is a sample (just one of the labels) that I use to change the child2's sourceobject:
Private Sub Import_Click()
Me.Child2.SourceObject = "ProfitLossImport"
Call allprocesses (calls function that changes backcolor)
End Sub
I have this attached to each labels ON CLICK event.
The code that changes the backcolor looks like this for each label:
Sub HighlightLabels()
If Me.Child2.SourceObject = "ProfitLossImport" Then
Me.Import.BackColor = 16777215
Me.Accruals.BackColor = 12632256
Me.UndoImp.BackColor = 12632256
Me.ZipFiles.BackColor = 12632256
Me.BuiltInReport.BackColor = 12632256
Me.CustomReport.BackColor = 12632256
Me.ExceptionReport.BackColor = 12632256
Me.CM2Report.BackColor = 12632256
Me.ImportTable.BackColor = 12632256
Me.AggregateTable.BackColor = 12632256
Me.ChartofAccountTable.BackColor = 12632256
Me.ProfitCenterTable.BackColor = 12632256
Me.YearTable.BackColor = 12632256
______________________________________________________
I tried using (CurrentControl = screen.activecontrol
Child2.sourcobject = CurrentControl) concept but I don't think labels can be in an active state? Please help!