Results 1 to 6 of 6

Thread: Exit Sub

  1. #1

    Thread Starter
    Registered User
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64

    Exit Sub

    I am trying to make it so it will just exit the sub if there is nothing else to be deleted.

    Private Sub DeleteItem()
    Dim j As String
    Dim f As String

    If rs.RecordCount <> 0 Then
    Exit Sub
    Else
    f = MsgBox("Are you sure?", vbYesNo + vbExclamation, "Delete Current Item?") 'Confirms the deletion
    If f = vbYes Then 'If Yes is clicked then it will delete the current item in lstserial
    j = lstItems.SelectedItem.Text 'j is a string for the text in the lstserial
    SelectData "List", "Applicaton", j 'This opens the data base and seaches for the selected item in the lstserial and deletes in the lstserial
    On Error Resume Next
    rs.Delete 'Deletes recordset in database
    InitDB "List", "Db.mdb", "Applicaton" 'This indeacates what Database, the list and what name
    Fill_ListView 'Fills lstserial with the records in the database
    Else
    Exit Sub
    End If
    End If
    End Sub

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629

    use vbcode tag

    hi there s3cur17y

    please use the vbcode tag when posting code... makes it readable


    [vbcode]
    MsgBox "u'r code goes here"
    [/vbcode]

    will look Like this

    VB Code:
    1. MsgBox "u'r code goes here"
    -= a peet post =-

  3. #3

    Thread Starter
    Registered User
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64
    <vbcode>
    if this work = True Then
    msgbox "Good!"
    end if
    </vbcode>


    VB Code:
    1. if this work = True Then
    2. msgbox "Good!"
    3. end if

    vbcode
    if this work = True Then
    msgbox "Good!"
    end if
    /vbcode

  4. #4

    Thread Starter
    Registered User
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64

    Vb Code Laidout

    Exit Sub
    I am trying to make it so it will just exit the sub if there is nothing else to be deleted.

    VB Code:
    1. Private Sub DeleteItem()
    2. Dim j As String
    3. Dim f As String
    4.  
    5. If rs.RecordCount <> 0 Then
    6. Exit Sub
    7. Else
    8. f = MsgBox("Are you sure?", vbYesNo + vbExclamation, "Delete Current Item?") 'Confirms the deletion
    9. If f = vbYes Then 'If Yes is clicked then it will delete the current item in lstserial
    10. j = lstItems.SelectedItem.Text 'j is a string for the text in the lstserial
    11. SelectData "List", "Applicaton", j 'This opens the data base and seaches for the selected item in the lstserial and deletes in the lstserial
    12. On Error Resume Next
    13. rs.Delete 'Deletes recordset in database
    14. InitDB "List", "Db.mdb", "Applicaton" 'This indeacates what Database, the list and what name
    15. Fill_ListView 'Fills lstserial with the records in the database
    16. Else
    17. Exit Sub
    18. End If
    19. End If
    20. End Sub

  5. #5
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    VB Code:
    1. If rs.RecordCount = 0 Then

    would that do it ?
    -= a peet post =-

  6. #6
    Frenzied Member blindlizard's Avatar
    Join Date
    Feb 2001
    Location
    Austin, TX - United States of America
    Posts
    1,141
    VB Code:
    1. If rs.EOF Then
    2.      Exit Sub
    3. End If
    I drink to make other people more interesting!
    [vbcode]On Error GoTo Bar[/vbcode]
    http://www.monsterlizard.com

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