By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,647 Members | 1,706 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,647 IT Pros & Developers. It's quick & easy.

Import window error message missing

P: 19
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.RunCommand acCmdImportAttachText
Msgbox "File Imported! ", vbInformation + vbOkOnly, "BegProcessMsg3"


Opps2:
Msgbox "Import Canceled! ", vbInformation + vbOkOnly, "BegProcessErrMsg2"
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.
May 13 '08 #1
Share this Question
Share on Google+
3 Replies


FishVal
Expert 2.5K+
P: 2,653
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
May 13 '08 #2

P: 19
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
May 20 '08 #3

FishVal
Expert 2.5K+
P: 2,653
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
May 20 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.