I have a command button on a form that should be visible or not visible depending on a value in the current record and the current users user level. The code below is working as in the immediate window i get true and false when appropriate. However the command button will stay in its current state for several records. At times when I switch to the immediate window and back the button will do what it is supposed to do (ie be visible or hide). I tried the repaint method to force it but did not suceed.
[CODE=vb]Private Sub Form_Current()
If (CurrentUser.Ge tUserLevel <= 10 And Me.txtQStatusTy pe = 9) Or (CurrentUser.Ge tUserLevel <= 10 And Me.txtQStatusTy pe = 13) Then 'Admin
Debug.Print "true"
Me.cmdAward.Vis ible = True
Me.Repaint
Else
Debug.Print "false"
Me.cmdAward.Vis ible = False
Me.Repaint
End If
End Sub[/CODE]
[CODE=vb]Private Sub Form_Current()
If (CurrentUser.Ge tUserLevel <= 10 And Me.txtQStatusTy pe = 9) Or (CurrentUser.Ge tUserLevel <= 10 And Me.txtQStatusTy pe = 13) Then 'Admin
Debug.Print "true"
Me.cmdAward.Vis ible = True
Me.Repaint
Else
Debug.Print "false"
Me.cmdAward.Vis ible = False
Me.Repaint
End If
End Sub[/CODE]
Comment