Hi,
Is there a way I can keep the focus on the current control if an If statement is false? But if true move to another field?
I currently have:
The first two aren't working though. The MsgBox is displayed but it still moves onto next control.
Second two are working fine.
I know this code can be shortened but I've separated it out so I can see it easier and try to find what's wrong!
(Ignore title sorry another problem I have but may be solvable with this issue!)
Thanks in advance!
Is there a way I can keep the focus on the current control if an If statement is false? But if true move to another field?
I currently have:
Code:
Private Sub TestStage_AfterUpdate()
If Unit_Type <> "SP2240" And TestStage = "ESSPASS" And PreESS_FTP = "NO" Then
MsgBox "My text"
TestStage.SetFocus
End If
If Unit_Type <> "SP2240" And TestStage = "ESSFAIL" And PreESS_FTP = "NO" Then
MsgBox "My text"
TestStage.SetFocus
End If
If Unit_Type <> "SP2240" And TestStage = "ESSPASS" And PreESS_FTP = "YES" Then
ESS_FTP = "YES"
ESS_Tested = "YES"
User.SetFocus
End If
If Unit_Type <> "SP2240" And TestStage = "ESSFAIL" And PreESS_FTP = "YES" Then
ESS_FTP = "NO"
ESS_Tested = "YES"
Me.Fails_SF.Test.SetFocus
End If
The first two aren't working though. The MsgBox is displayed but it still moves onto next control.
Second two are working fine.
I know this code can be shortened but I've separated it out so I can see it easier and try to find what's wrong!
(Ignore title sorry another problem I have but may be solvable with this issue!)
Thanks in advance!
Last edited: