Results 1 to 4 of 4

Thread: Error Message Question - Is this ok! (resolved)

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Location
    The Attic of VB Hell (West Cork, Ireland)
    Posts
    2

    Error Message Question - Is this ok! (resolved)

    Hey,

    I have the following code:

    On Error GoTo Errhandle
    'Replace(frmSearchResult2.txtSurname.Text, "'", "''") As String
    'Replace(frmSearchResult2.txtFirstName.Text, "'", "''") As String
    'Replace(frmSearchResult2.txtAddress.Text, "'", "''") As String
    Dim message As String


    If cboTitle.Text = "" Then
    message = MsgBox("Please enter a title for the customer", vbOKOnly, "Please enter a title")
    Else
    If txtSurname.Text .................[more code]

    message = MsgBox("The changes have been made to the customer", vbOKOnly, "Changes Saved")
    Unload Me
    End If
    End If
    End If
    End If
    End If
    End If
    End If
    Exit Sub

    Errhandle:
    If Err.Number = 1000 Then
    message = MsgBox("Hhhmm")
    Else
    message = MsgBox("The program is generating an unidentified error. A number of issues may be occurring You may have included illegal symbols such as ',& or *. --> You may be trying to create an item that has certain dependencies in the database Example: In order to create an order you must have a related customer. --> If selecting an item from a datagrid ensure that you are selecting the item correctly. One or more of these may apply. Please check your action and try again. ", vbOKOnly, "Catch All Error Message")
    Exit Sub
    End If

    End Sub

    It's not the poor quality of the Error handling that I'm worried about (good thing) .. but unless I have the Exit Sub above the Errhandle the error message keeps showing up even when the code executes. Is this the best way to avoid the message or is there a proper way that I'm missing (or am I randomly right)

    Thanks!
    WAQ
    Last edited by WorkAroundQueen; Jul 29th, 2003 at 11:16 AM.
    The brave do not live forever but the cautious do not live at all

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