Sabtu, 27 Juni 2015

[MS_AccessPros] Problem on error procedure

 

Good morning,

I have one issue with error procedure

There is one function (number 1) that call the function number 2 giving it  two variables

In function number 2 there is an error procedure:

At the beginning there is this line that call the error procedure

 

 

"On Error GoTo errhandler"

 

At the end of this mail there is written the error procedure

 

The function 2  read a table using do loop cycle  where is written the path where find many excel sheet to be imported using the command:

 

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, destable, filenamefinale, False, des & "!"

 

 

The case "case 3125" appear when the name of the file  that is in the table that the do loop cycle read,  is not found in excel sheet

The procedure tell to the operator that the sheet there Is not in the file and go to the end of the loop to read next sheet.

effectively  the error procedure is working the first time  the procedure find this issue and bypass it going on to the next, but going  on reading using the doo loop  cycle, one  time that find another error with the same code 3125, it look like the error procedure is not anymore working and the program stop showing the error 3125 as if the error procedure is not active.

My goal  is that each time one sheet Is not find bypass it, but actually this occur only the first time.

 

 

Somebody have some idea why occur this issue and how to solve?

Thank you  to all

 

Valentino

 

errhandler:

Select Case Err

 

    Case 2391

   

        db.TableDefs.Delete destable

        Resume

    Case 3078:

   

        varia = 1

        Err.Clear

        Resume Next

       

   

    Case 3125

        MsgBox "I do not find the sheet named " & des & "This Sheet will be bypassed"

        varia = 0

        Err.Clear

     

       

        GoTo fine

   

   

   

    Case Else:     

           MsgBox "Error # " & Err & " : " & Error(Err)

 

   

   

End Select


__._,_.___

Posted by: Valentino Avvisati <valentino.avvisati@gmail.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

.

__,_._,___

Tidak ada komentar:

Posting Komentar