I currently have the first listed set of code located behind one of my textboxes on a form. It is used to validate data entry on my form. The code works like it should when entering the data. But everytime i close or exit the form the code excutes and diplays the msgbox and inputbox. Is there a way to cancel this code just during the exiting of the form. I have tried other event but to no success. The second set of code is what i used stop the validation code from excuting as the form loads . I was tryed to do the same for the unload but to no succes.
Any Ideas?
Thank you,
Tim
Private Sub txtSerial_Exit(Cancel As Integer)
If testing = False Then
Exit Sub
End If
Dim VSid As String
VSid = Len(txtSerial.Text)
If VSid = 11 And testing = True Then
txtMillTube.SetFocus
Else
MsgBox "Invalid Virgo Serial Number" & vbCrLf & vbCrLf & " Please Rescan Correct Tag", vbOKCancel
Me!txtSerial = Null
txtSerial.Value = InputBox("Please Rescan Correct Tag"
Me!txtSerial.SetFocus
End If
End Sub
Option Compare Database
Option Explicit
Dim testing As Boolean
Private Sub Form_Close()
testing = False
End Sub
Private Sub Form_Load()
testing = True
End Sub
Any Ideas?
Thank you,
Tim
Private Sub txtSerial_Exit(Cancel As Integer)
If testing = False Then
Exit Sub
End If
Dim VSid As String
VSid = Len(txtSerial.Text)
If VSid = 11 And testing = True Then
txtMillTube.SetFocus
Else
MsgBox "Invalid Virgo Serial Number" & vbCrLf & vbCrLf & " Please Rescan Correct Tag", vbOKCancel
Me!txtSerial = Null
txtSerial.Value = InputBox("Please Rescan Correct Tag"
Me!txtSerial.SetFocus
End If
End Sub
Option Compare Database
Option Explicit
Dim testing As Boolean
Private Sub Form_Close()
testing = False
End Sub
Private Sub Form_Load()
testing = True
End Sub