0
0 1
I have several transparent command buttons on top of labels that, when
clicked, show/hide various forms. (Sort of a navigation menu of
sorts.)
The command buttons work fine, when the code is like this:
Private Sub cmdMenu1_Click()
Me.frmMenu1Stuff.Visible = True
Me.frmMenu2Stuff.Visible = False
etc.
End Sub
But the moment I start adding some code to reformat the labels (to
give a visual clue as to what menu the user clicked and is on), the
command buttons become disabled. For example:
Private Sub cmdMenu1_Click()
Me.frmMenu1.Visible = True
Me.frmMenu2.Visible = False
etc.
Me.lblMenu1.ForeColor = vbBlack
Me.lblMenu1.BackStyle = 1
Me.lblMenu2.ForeColor = vbWhite
Me.lblMenu2.BackStyle = 0
etc.
End Sub
After I add this code, cmdMenu1 works on the first click, but
thereafter it stops working, even after I close and reopen the
database. It "clicks" but doesn't execute any code - even a simple
MsgBox "Test" command I add to it. To troubleshoot, I've moved the
command buttons off to the side of the labels (in case the label was
moving to the front), made them not transparent (so I can that they
actually do get clicked), etc. - but the behavior is the same.
It's as if the formatting code I added somehow changes a property of
the command button, even though none of the code references it.
I'm completely stumped. I've also decompiled and compacted and
repair.
Any ideas?
clicked, show/hide various forms. (Sort of a navigation menu of
sorts.)
The command buttons work fine, when the code is like this:
Private Sub cmdMenu1_Click()
Me.frmMenu1Stuff.Visible = True
Me.frmMenu2Stuff.Visible = False
etc.
End Sub
But the moment I start adding some code to reformat the labels (to
give a visual clue as to what menu the user clicked and is on), the
command buttons become disabled. For example:
Private Sub cmdMenu1_Click()
Me.frmMenu1.Visible = True
Me.frmMenu2.Visible = False
etc.
Me.lblMenu1.ForeColor = vbBlack
Me.lblMenu1.BackStyle = 1
Me.lblMenu2.ForeColor = vbWhite
Me.lblMenu2.BackStyle = 0
etc.
End Sub
After I add this code, cmdMenu1 works on the first click, but
thereafter it stops working, even after I close and reopen the
database. It "clicks" but doesn't execute any code - even a simple
MsgBox "Test" command I add to it. To troubleshoot, I've moved the
command buttons off to the side of the labels (in case the label was
moving to the front), made them not transparent (so I can that they
actually do get clicked), etc. - but the behavior is the same.
It's as if the formatting code I added somehow changes a property of
the command button, even though none of the code references it.
I'm completely stumped. I've also decompiled and compacted and
repair.
Any ideas?