MkIIISupra
Programmer
I don't understand what is going on or why the code is not working. I have tried it two ways that I can think of but the SetFocus command is not working at all. The other portions of the case statement are functioning perfectly it's just the SetFocus command that is not working! I am on XP Pro with Office 2003.
Method One
Private Sub orgTp_LostFocus()
Dim intL As Integer ' Dim Var
intL = Len(Me.orgTp) ' Set Var value based on field length
Select Case intL ' Test the Var value and act accordingly.
Case 7
Me.orgTp.Value = UCase(Me.orgTp)
Case 10
Me.orgTp.Value = UCase(Me.orgTp)
Case Else
MsgBox "I am sorry but your ORG-TP is " & intL & " characters long. It must be either 7 or 10 characters in length." _
& vbCrLf & "Please correct your entry, thank you."
Me.orgTp.SetFocus
End Select
End Sub
Method Two
Private Sub orgTp_LostFocus()
Dim intL As Integer ' Dim Var
intL = Len(Me.orgTp) ' Set Var value based on field length
Select Case intL ' Test the Var value and act accordingly.
Case 7
Me.orgTp.Value = UCase(Me.orgTp)
Case 10
Me.orgTp.Value = UCase(Me.orgTp)
Case Else
Me.orgTp.SetFocus
MsgBox "I am sorry but your ORG-TP is " & intL & " characters long. It must be either 7 or 10 characters in length." _
& vbCrLf & "Please correct your entry, thank you."
End Select
End Sub
One by one the penguins steal my sanity!
Method One
Private Sub orgTp_LostFocus()
Dim intL As Integer ' Dim Var
intL = Len(Me.orgTp) ' Set Var value based on field length
Select Case intL ' Test the Var value and act accordingly.
Case 7
Me.orgTp.Value = UCase(Me.orgTp)
Case 10
Me.orgTp.Value = UCase(Me.orgTp)
Case Else
MsgBox "I am sorry but your ORG-TP is " & intL & " characters long. It must be either 7 or 10 characters in length." _
& vbCrLf & "Please correct your entry, thank you."
Me.orgTp.SetFocus
End Select
End Sub
Method Two
Private Sub orgTp_LostFocus()
Dim intL As Integer ' Dim Var
intL = Len(Me.orgTp) ' Set Var value based on field length
Select Case intL ' Test the Var value and act accordingly.
Case 7
Me.orgTp.Value = UCase(Me.orgTp)
Case 10
Me.orgTp.Value = UCase(Me.orgTp)
Case Else
Me.orgTp.SetFocus
MsgBox "I am sorry but your ORG-TP is " & intL & " characters long. It must be either 7 or 10 characters in length." _
& vbCrLf & "Please correct your entry, thank you."
End Select
End Sub
One by one the penguins steal my sanity!