VBA Access display label

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • johnnyc
    New Member
    • Oct 2011
    • 22

    VBA Access display label

    Hello,

    I have a form that is locked by default, if a user wants to make an edit they have to hit the unlock button. I want to display a label to let them know the form is locked at the top, so new users don't assume it doesn't work.

    My logic is: The unlock button has a method where it enable edits to the form once clicked. My code based on that is as follows;

    Code:
    Private Sub lbl_unlock_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    
        If Me.AllowEdits = True Then
        Me.lbl_unlock.Visible = True
        
        Else
        Me.lbl_unlock.Visible = False
        
        End If
        
    
    End Sub
    This does not work as the label is constantly there regardless if the form is locked or unlocked. Should I be using some code that bases the label visibility when the Unlock button gets clicked or should this work but I have the wrong logic?

    Any help is appreciated.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You should put the code in the unlock button. The event you're using only fires when you move the mouse over the lbl_unlock control.

    Comment

    • johnnyc
      New Member
      • Oct 2011
      • 22

      #3
      You're right. It worked. Thank you!

      Comment

      Working...