Import window error message missing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Reedsp
    New Member
    • Apr 2007
    • 19

    Import window error message missing

    I am using Access 2007. In Access 2003, when you had the import window opened and clicked on the Cancel button, MS displayed an error message. To compensate for this using VB code, I used the "On Error" function because I am opening the Import window using VB code. I want to code to do something if the user clicks on the cancel button.

    Code:

    On Error Goto Opps2
    DoCmd.RunComman d acCmdImportAtta chText
    Msgbox "File Imported! ", vbInformation + vbOkOnly, "BegProcessMsg3 "


    Opps2:
    Msgbox "Import Canceled! ", vbInformation + vbOkOnly, "BegProcessErrM sg2"
    Goto End1

    End1:
    End Function

    Question: Does anyone know how to fix this issue. If the Import cancel button no longer generates an error, how do you program a custom message when the cancel button is clicked.
  • FishVal
    Recognized Expert Specialist
    • Jun 2007
    • 2656

    #2
    Hi, Reedsp.

    You may try to check whether records were added or new table was created after import wizard finishes. BTW, Access2003 throws the error only when OpenFile dialog is canceled, if cancel is clicked while the wizard runs then VBA code execution proceeds silently.

    Regards,
    Fish

    Comment

    • Reedsp
      New Member
      • Apr 2007
      • 19

      #3
      Records are imported into a existing table. But the cancel button is being clicked before the import wizard even gets to that point. In Access2003, the import window threw a error when you clicked the cancel button at any point in the wizard. In Access 2007, is seems like this is not occuring that no error is generated. Access 2007 accepts the cancel button and moves on to the next line of code. If this is true, how would you program around this issue so your code will not continue?

      Thanks, ReedSP

      Comment

      • FishVal
        Recognized Expert Specialist
        • Jun 2007
        • 2656

        #4
        Originally posted by Reedsp
        Records are imported into a existing table.
        So, why not to compare records count before and after import?

        But the cancel button is being clicked before the import wizard even gets to that point. In Access2003, the import window threw a error when you clicked the cancel button at any point in the wizard. In Access 2007, is seems like this is not occuring that no error is generated. Access 2007 accepts the cancel button and moves on to the next line of code.
        I've checked that in Access 2003. It throws an error only when initial OpenFile dialog was cancelled. When user clicks cancel in wizard dialogs code execution proceeds silently.

        Regards,
        Fish

        Comment

        Working...