Question Import Excel Data Macro Error

Dhamdard

Dad Mohammad Hamdard
Local time
Today, 14:57
Joined
Nov 19, 2010
Messages
103
Dear all,

I have designed a macro in Access 2007 that imports data from 4 excel files. Name of excel files are Form A, B, C and D. I recently installed Access 2010. Now when I click the import button, the macro pops up a message saying that "Form A" doesn't exist in the specified location - this is true. But Form B, C and D are there. I want the macro to import data from those files only that exist in a specified location.

In Access 2007, database would import existing data only. It didn't give me a message if Form A or any other form wouldn't exist in the specified location.

What can I do to make the macro behave similar to what it was doing in previous version?

Appreciate your help.

Regards,
Dad
 
Try putting...

Code:
DoCmd.SetWarnings False

prior to starting the import and then

Code:
DoCmd.SetWarnings True

when all done.
 
I did it but still if one of the forms doesn't exist in specified location, it gives me the message and stops all other macro actions.

Code:
DoCmd.SetWarnings False
    DoCmd.RunMacro "Delete_DataInImportedTables_Before_this_Import", , ""
    DoCmd.TransferSpreadsheet acImport, 8, "Form A", "C:\data\Form A - Activity Report Form.xls", True, ""
    DoCmd.RunMacro "Appended_AllImported_To_Original_Tables", , ""
    Beep
    MsgBox "Import successfully completed. Please look at the 'Import Report' to see if all records have been imported.", vbInformation, "XXX Database"
    DoCmd.OpenForm "Import_Report", acNormal, "", "", , acNormal

DoCmd.SetWarnings True
 
It's simple enough to check whether it exists before running it.
 

Users who are viewing this thread

Back
Top Bottom