Results 1 to 12 of 12

Thread: 3043 - Disk or network error

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Location
    Dayton, OH USA
    Posts
    119

    Question

    I have a button on a form that does a db backup to the A drive. If there is no disk in the drive I get an error 3043, "Disk or network error" which I trap for and display a msgbox. For some reason after the message box is displayed and the user clicks OK you can no longer do a backup. It is almost like the button click does not run the sub routine anymore. You have to close the app and re-open it and click it again. Anyone seen this before...? If so how can I fix it. How can I make the button run the backup routine again after erroring out once?

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Put breakpoints into your button click event, to see what's happening.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Location
    Dayton, OH USA
    Posts
    119
    Here is the code:

    Private Sub cmdBckNow_Click()
    Set wrkDefault = DBEngine.Workspaces(0)

    On Error GoTo err_handle

    If InStr(1, txtMedia.Text, ".mdb", vbTextCompare) = 0 Then
    MsgBox "Error"
    Else
    db.Close
    DBEngine.CompactDatabase RetAppPath, txtMedia.Text
    Call frmMain.Initialize
    Call frmMain.Gath_Comp
    Call frmMain.Fill_Comp
    End If

    err_handle:
    If Err.Number = 3043 Then
    MsgBox Err.Description, vbInformation, "Error"
    Exit Sub
    End If
    End Sub

    I figured if I did an Exit Sub in the err_handle that it would exit the sub and then when the button was clicked again it would re-enter and run the code. This is not the case. Cannot figure it out....

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Try this:
    Code:
    Private Sub cmdBckNow_Click() 
        On Error GoTo err_handle
    
        Set wrkDefault = DBEngine.Workspaces(0)
    
        If InStr(1, txtMedia.Text, ".mdb", vbTextCompare) = 0 Then 
            MsgBox "Error" 
        Else 
            db.Close 
            DBEngine.CompactDatabase RetAppPath, txtMedia.Text 
            Call frmMain.Initialize 
            Call frmMain.Gath_Comp 
            Call frmMain.Fill_Comp 
        End If
        Exit Sub
    
    err_handle: 
        If Err.Number = 3043 Then 
            MsgBox Err.Description, vbInformation, "Error" 
            Exit Sub 
        End If 
    End Sub
    I added an Exit Sub just before the error handler code. It's a long shot, but is often a good idea to do anyway. Is there something in your frmMain.Initialize, etc. functions that might disable it somehow?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Location
    Dayton, OH USA
    Posts
    119
    That still does not do it. The frmMain.Initialize function just re-opens the database connection after doing the backup, does not disable anything. After the code receives the 3043 error it goes directly to the err_handle and does not make it to the frmMain.Initialize function. You would think that after the err message is displayed it would hit the exit sub and bail out so that when you came back to click it again it would re-run, wierd.

  6. #6
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    To tell you the truth, I've never seen this happen before. A possibility is that VB's error handling is going nuts, and always bypassing the function . Does it display "Error" or anything like that afterwards, or does it just stay silent?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Location
    Dayton, OH USA
    Posts
    119
    Heres the other strange thing. I have two completely seperate forms that run a database backup. If I encounter the 3043 on one form the database backup will not work anyplace else within the program from any other form until I close the app and re-open it.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Location
    Dayton, OH USA
    Posts
    119
    It displays the err_handle message box and then stays silent. Everytime you click the backup db button after the error it does nothing, no error message, no app crash, nothing.

  9. #9
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    Try a breakpoint in the commandbutton click event. When you click after the error, does it break?
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Location
    Dayton, OH USA
    Posts
    119
    I put the breakpoint here:

    Sub cmdBckNow_Click()

    It breaks when I first click the button, I hit run again, it errors out, I click the button again and it breaks. Is this what you wanted to know?

  11. #11
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Yes. We now know that it is opening the event. From this breakpoint, single-step through it to find out where it's going strange.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Location
    Dayton, OH USA
    Posts
    119
    I figured it out. Never did the debugging stuff before, very helpfull! The problem was I close the DB just before I do the backup, it runs the msgbox but does not open the db again so it is closed. It had something to do with that. So I open the db again just after I display the err message and now it works! Thank you very much for your help.....

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