|
-
Nov 2nd, 1999, 08:54 PM
#1
Thread Starter
Junior Member
i am using a lostfocus()routine that checks to see if a field contains the correct information. If it does not I set focus back to that text box then I display a message box. The app works before I make it an executable, however, when I run it as an executable I receive a run time error 5 every time I lose focus with incorrect information. Before it displays the message box it gives me the error then displays the message box then upon clicking ok the app shuts down. The following is the code:
Private Sub startonpeak_LostFocus()
If Not IsNumeric(startonpeak.Text) Then
startonpeak.SetFocus
MsgBox "Please enter the start on peak reading for channel 1.", vbOKOnly
Else
startonpeak.BackColor = vbWhite
End If
End Sub
Any ideas?
-
Nov 2nd, 1999, 08:59 PM
#2
Member
Use the Validate event instead of the LostFocus event. Make sure that the Causes Validation property of your controls is set to True. This will allow you to cancel the moving of focus by setting Cancel=True.
-
Nov 2nd, 1999, 09:00 PM
#3
Thread Starter
Junior Member
Could you explain this a little further?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|