justme1310
Technical User
Hi everyone,
When I enter a numeric value for BP_Sys, the following code is supposed to validate the value. If it falls outside of the accepted range, it is supposed to display an error msg an return and highlight the error value.
What actually happens is the error msg gets displayed, BUT the field after the invalid field (BP_Sys) gets selected and highlighted.
What am I doing wrong?
Thanks
Will
When I enter a numeric value for BP_Sys, the following code is supposed to validate the value. If it falls outside of the accepted range, it is supposed to display an error msg an return and highlight the error value.
What actually happens is the error msg gets displayed, BUT the field after the invalid field (BP_Sys) gets selected and highlighted.
What am I doing wrong?
Code:
Private Sub BP_Sys_AfterUpdate()
If ((BP_Sys < 100) Or (BP_Sys > 130) Or (IsNull(BP_Sys)) Or (Len(BP_Sys) < 3)) Then
MsgBox ("Invalid entry. Valid range [100 - 130]. Please enter a valid Systolic Blood Pressure.")
DoCmd.GoToControl ("BP_Sys")
Me!BP_Sys.SelStart = 0
Me!BP_Sys.SelLength = Len(Me!BP_Sys) + 1
End If
End Sub
Thanks
Will