Reputation: 105
I have a textbox labeled, "Lot Number" in a form called, "Receiving Inspection Form". My users have to enter a lot number from material that has been received by our company. I want every 5th lot number to be checked by the inspector. Here is my code:
Private Sub Lot_Number_AfterUpdate()
Dim x As Integer
x = 0
If EndsWith(x) Then
MsgBox "MUST PERFORM SPECTROMETER TEST!!!!!"
Me.Lot_Number.SetFocus
Exit Sub
End If
End Sub
Upvotes: 0
Views: 71
Reputation: 56026
Try this - and address the user politely:
Private Sub Lot_Number_AfterUpdate()
Dim Lot As Integer
Dim Sec As Integer
Sec = Second(Time) \ 2
Lot = Val(Right(Nz(Me!Lot_Number.Value), 1))
If Lot Mod 5 = Sec Then
MsgBox "Please perform spectrometer test.", vbInformation + vbOkOnly, "Inspector Check"
Me!Lot_Number.SetFocus
End If
End Sub
Upvotes: 1