Hi,
On the first issue, I think the problem is that you are trying to disable the control on an event for the control, which you can't do. So what I would do is something like:
Private Sub ID_Oper_B_LostFocus()
Me.AnotherControl.SetFocus = True 'you may not need = True
'Me.AnotherControl.SetFocus
End Sub
(alternatively, you can set this in the tab order for the form.)
then:
Private Sub AnotherControl_GotFocus()
Me.ID_Oper_B.Enabled = False
End Sub
On the second issue, BeforeUpdate is not going to fire until the record is saved, so moving to the next control should not fire the event. In that case you could do this:
Private Sub ID_Oper_B_LostFocus()
If Me!IDOperB = "joaquim" Then
Me!Operação.Enabled = True
Me!Operação.Locked = False
Me!Operação.SetFocus = True 'or
'Me!Operação.SetFocus
Else
Me!Operação.Enabled = False
Me!Operação.Locked = True
End If
End Sub
Disabling the control will take if it out of the tab order.
Did any of that help?
mmcdonal
Look it up at:
http://wrox.books24x7.com