Results 1 to 3 of 3

Thread: Run Time Error

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 1999
    Location
    St. Louis, MO USA
    Posts
    21

    Post

    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?

  2. #2
    Member
    Join Date
    Jan 1999
    Location
    Longmont,CO
    Posts
    53

    Post

    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.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Oct 1999
    Location
    St. Louis, MO USA
    Posts
    21

    Post

    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
  •  



Click Here to Expand Forum to Full Width