Results 1 to 3 of 3
  1. #1
    Tsquare is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2016
    Posts
    1

    Excel Import Error


    After upgrading from Access 2007 to 2010, I can no longer import an excel file. The exact message that I receive is:

    "The database cannot be opened because the VBA project contained in it cannot be read. The database can be opened only if the VBA project is first deleted. Deleting the VBA project removes all code from modules, forms, and reports. You should backup your database before attempting to open the database and delete the VBA project.

    To create a backup copy, click Cancel and then make a bacjkup copy of your database. To open the databse and delete the VBA project without creating a backup copy, click ok."

    Thanks in advance

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    uh-oh, this sounds like a corruption. (not because of Excel, but it could be. who knows why these things corrupt)
    restore a backup, because youve lost ALL vb code. I hate when Access does this.
    backups. LOTS of backups.

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    If you can hold down the shift key and open the dB, maybe this will help.

    I lost my FE dB... ever so slowly. No error messages. Starting up took longer and longer. Finally, some of the code wouldn't execute.
    Took me almost 2 and a half weeks to recover. Since this happened over time, the backups also had corruption. (Major stress!!! )

    I was able to use the undocumented command "ExportAsText" (after hours of searching the Net) to recover the code, but creating a new mdb (was using A2000 at the time), importing objects and adding the code didn't fix the corruption. The VBA project was corrupt. So any code added was being added to the corrupt VBA project. If you don't want/can't the use undocumented command "ExportAsText", and you can see the code, copy it and save it in a text file. Do this for ALL forms, reports and modules - I used separate text files for each.

    After long hours of searching the web, I finally found one line that seemed to solve my issue (at least the coding issue)....
    After exporting all of the text, I had to go to EACH form and report and set the "Has Module" property to NO. This will delete the VBA (corrupted) code. Any code remaining (ie the standard modules) should be deleted (hopefully you. were able to copy it).

    Save the changes to the dB.
    Do a compact and repair of the current "bad" dB. Save, close and open the dB.
    Import what is left of the "bad" database - tables, queries, forms and reports to the a new database. (I never use macros so no problems there)

    Open each of the forms & reports, one at a time, pasting in the appropriate code from the text files. After you paste in the code for a form/report, do a "Compact & Repair".


    Part of the problem was I waited too long between saves. Also didn't run compact and repair often enough.
    Another major cause of corruption was editing code while the code was executing. I would set a break point and add/delete/comment/edit code while paused. Needless to say, I don't do that any more!


    Good luck.....

Please reply to this thread with any new information or opinions.

Similar Threads

  1. "DLL Error" message trying to import from Excel
    By buddyboy in forum Import/Export Data
    Replies: 4
    Last Post: 03-19-2015, 06:26 PM
  2. Replies: 5
    Last Post: 09-18-2014, 12:26 PM
  3. Replies: 3
    Last Post: 12-13-2013, 07:03 AM
  4. Import Excel spreadsheet Search key not found error
    By synses in forum Import/Export Data
    Replies: 1
    Last Post: 07-01-2013, 11:05 AM
  5. Excel import error
    By limez0r in forum Programming
    Replies: 1
    Last Post: 11-15-2010, 08:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums