The database cannot be opened because the VBA cannot be read - ms-access

I have an Access, 2007 – 2016, accdb database on my Toshiba Satellite Pro running Windows 7 32 bit. I am using MS Office 365.
The database that opens at its home page, but any attempt to open a table, form or module brings up this message:
“The database cannot be opened because the VBA project contained in it cannot be read…”
I have 2 backups of this database, but they do the same thing.
I have read several posts on the internet that indicate that the problem can be solved by decompiling the database.
I have tried the VBS Script solution contained in:
How does one decompile and recompile a database application?
However, it does not get to decompile as the same message displays when the .vbs file opens the database.
I have read some other posts that indicate a problem with a VBA7 file, but these refer to Access 2010, so I do not know if they also apply to me. I have VBA7.1 by the way.
Attempts to decompile through the Command Prompt has its own problems that seem to be associated with file names with spaces.
So, I’m stuck. Any help would be much appreciated

I ran into this same error at work, Have you tried shift-clicking and opening? I know that seems obvious, What I did, was I got the DB open in safe mode, and opened up a module in the vba editor, and tried to fight the problematic code, if anything you could delete all your modules after copying them into a notepad.
I also right clicked and restored previous versions from windows, I am not sure if you have tried this when you say you have to back ups, but i was unaware of this fix and i luckily had a version from last week that fixed my issue.

Related

SSIS transferring data from Excel could not retrieve table information

I have been trying since yesterday and beating my head against a wall trying to obtain data from an excel provider.
I have literally tried everything. I double checked so as to make sure whether my version of excel is 32 bit, it is 32 bit. I even installed the x64 version of Microsoft database engine it still did not change the slightest thing. I have changed Run64BitRuntime to false and delay validation to true. Nothing has changed in the slightest. I have tried using the work book from 2003-2007 and 2007+ to save and then use it still has not changed a single thing. It feels like i am banging my head against the wall after watching countless youtube videos tons of online articles and it still does not seem to work. I would really appreciate some help. The version of Visual Studio i am using is 2019.
SSIS transferring data from Excel could not retrieve table information is the error message i always get after tons of tries.
Have you tried all Excel versions in the Excel Connection Manager? Also, close the Excel workbook while working on the SSIS package.

Comboxes suddenly don't autocomplete in Access 2013

-------------UPDATE-------------
By coincidence I actually found an old post, posted a year ago, by myself with sort of the same problem (totally forgot about it). I suddenly remembered that there was a problem with a reference not being there. Back then I changed everything to late-binding. About a half year ago I created my own COM add-in in C# for my access application, I register this COM object with a script but at this specific user this didn't work. When turning off the specific reference, everything worked again. Conclusion: the bugs / errors were caused by the broken / missing reference...
----------------------------------------------
In the category of weird access problems I have another problem.
In my access 2013 application all the comboboxes don't autocomplete any longer on 1 specific computer. The items are in the list but autocomplete just doesn't work anymore. I have read several other related problems but all those solutions don't work. I have checked / tried the following:
Repaired the database
use the DISTINCT keyword in my rowsource (ANSI-92 issue related)
set the auto-expand property to yes
The weird thing is that other users use the exact same file (it is being copied to local) and at their computers it does work..
The file is of type accde. A week ago I had the same problem and I tried to open the same file but instead of opening the accde version I opened the accdb version at this specific users computer and that seemed to work (autocomplete was working again). This worked for about a week but now it is someway corrupted again (I did change the file however and deployed it again recently so that might have to do something with it). '
Besides the combobox autocomplete problem, the same user has also the problem that one specific form doesn't open any longer (again, at the other users it just opens fine), the error is 2467 and it errors on setting the alloweditions of the subform through code. Though it is just weird that this don't causes errors on the other computers so I suspect it is related to the same 'bug' as with the autocomplete.
Anyone experienced the same problems?
Some additional information:
the accdb file is coded /created in access 2013
the users are opening the accde file in access 2013 runtime, the user where the file seems to be corrupted opens the accdb file in the full version of access 2016 (the temporary solution up till now).
The access application uses SQL Server 2012 as back-end.
Fixed it!
By coincidence I actually found an old post, posted a year ago, by myself with sort of the same problem (totally forgot about it). I suddenly remembered that there was a problem with a reference not being there. Back then I changed everything to late-binding. About a half year ago I created my own COM add-in in C# for my access application, I register this COM object with a script but at this specific user this didn't work. When turning off the specific reference, everything worked again. Conclusion: the bugs / errors were caused by the broken / missing reference...

Corrupt access front end accdb after mixing office versions

I have a problem with a DB I started work on a couple of years ago in Access 2010. I fired it up last week and now I'm getting an "unrecognized database format" error when I try and open the front end.
I left this project sat after the company lost interest in finishing it. Since then I worked on another project on the same dev machine which required me to install Access 2007. I had both 2010 and 2007 installed at the same time and I remember opening the now problematic db to take some snippets from some code in there for use in the other project. Im pretty sure I only opened it in 2010 at that time.
Now the company has shown interest again I need to finish the project.
Ive tried uninstalling all instances of Office and the Access Database Engine (I needed this to test the 2007 project) running a clean up and putting a fresh install of 2010 back, but Im still getting the same error. Ive tried importing the objects from the accdb file into a new db but access still throws the unrecognized database format error. The same error is given if I try to decompile as well.
Today Ive tried uninstalling office 2010 and putting a clean 2007 install to see if I can open/decompile/import from the older db under that version of access but Im faced with the same error.
The file server where I backed up to has been rebuilt since I worked on the original project and I thought that the accdb file might have been corrupted during this process as Im pulling it from the old vhd. I've also pulled backups from several locations and all the files give me the same error. Ive even tried running them on one of the clients where I know it used to work and has not been had office tampered with since I was last looking at this and still I get the same error. I know that I had compact and repair on exit set on the front end and Im wondering if I managed to inadvertently use 2007 and the last time I opened it and royally screwed it up unknowingly creating a little surprise for me here two years down the track!
I have even tried installing an "Access Recovery Toolbox" util to see what that could make of the file, and it pulls absolutely nothing back in the report.
I have a much older version of the db which works on my dev machine but Im at a massive loss if I have to start work from this version as I made some very significant changes between these versions including changes to the back end table structure.
Any light anyone can shine, even if it just means getting the VBA out into a text file would be really helpful!!
TIA
Have you tried creating a new DB and pulling in the tables, forms, etc from the bad DB? I would recommend doing it incrementally and checking the new DB after each import. IE just bring in the tables and then see if they are healthy before moving on.

All forms and code vanished from Access database

An Access database with a load of queries, tables, reports and forms with VBA code.
Was used in Access 2010 for ages, then some users upgraded to Office 2013 very recently.
One user had a "problem" on their computer while using the database, which may have resulted in their computer restarting, and now the database seems to have no forms or code visible when opened.
Googling finds reports of similar situations where the forms and code was there but invisible.
Any ideas?
The first thing to attempt is to open the database and choose Compact and Repair. I would then go into the VB Editor, if possible, and choose the Debug menu, Compile. While in the VB Editor, also check Tools, References for any missing references.
If the database is split to a back-end and front-end then just give them a new copy of the front-end. If this doesn't work then I would re-install Office on their computer.
If they have their own copy of the database (it is not split) then give them a new copy.
If they have already entered data that needs to be kept then I would start a new database and import all of the Access objects from the existing database. I have found that re-importing all objects solves most of these issues. You could import just the tables from their copy of the database, but the other objects from another copy.
If re-importing all objects doesn't resolve the issue then a remaining option is use the decompile command-line option:
C:\Program Files\Microsoft Office\Office15\MSACCESS.EXE /decompile
Open Access from this command-line, go into the VB Editor and choose the Debug menu, Compile. Then close, re-open and Compact and Repair.

Is there a way to export code from a corrupt database?

Last week I was modifying portions of two modules in an access 2010 db when the program crashed, and would crash every time I tried opening up the db thereafter. I was able to create a new database and import the tables and queries from the corrupted one, but when I tried to import the forms/macros/modules the new database would start crashing also. I keep daily backups, but ended up losing several hours worth of work. This happened twice last week, each time MS Access would crash without warning and the VBA was unrecoverable.
The functionality works as intended until the db crashes seemingly at some unknown point. There must be some sort of issue with my VBA code, since this only started happening when I started modifying the module last week, but I can't pinpoint it since the crashes actually occurred when nothing was being executed. Ie during save.
Does anyone know if it's possible to export the VBA out of access without exporting it to another database? Ie export it without having to use MS Access to do so. On a related note, has anyone created a library that exports query definitions, table schema, and all VBA to text files that I could drop them into source control?
Thanks.
In addition to the method suggested by #Remou, you could try the SaveAsText method to save a code module to a text file.
Application.SaveAsText acModule, "Module1", "D:\Access\Module1.txt"
However, that doesn't satisfy your desire to do it without using Access.
Try a decompile operation on the chance your project includes saved compiled code which has been corrupted. You can find detailed instructions for decompile in the 2 answers to this Stack Overflow question: ms-access: HOW TO decompile and recompile
After decompile, make sure all your modules include Option Explicit in their Declarations sections. Check the project's references, and fix any that are broken (missing). Then run Debug->Compile from the VB editor's main menu to verify your code compiles without error.
Those steps are the best I can offer to reduce potential for continued corruption problems.
For integrating source control with Access, start with this selection of related Stack Overflow threads: site:stackoverflow.com ms-access version control
Folks
We're having the same problem. There is a bug in SP1 that causes it. If you keep opening the database, you'll finally end up with a backup that works - rename the old one BROKEN and remove the _backup from the new database, and you are oky till your next bit of development. Our IT guys (Microsoft Gold Partners) are looking at a fix reported on http://answers.microsoft.com/en-us/office/forum/office_2010-access/access-2010-sp1-you-receive-random-crashes-in/d2bf6175-075a-4a12-a2b1-f55d40af271b
I may go take a look at decompile/recompile however as some of our database have come all the way up from Access 97, to 2000, 2003 and now as mdb/2003 file format still, running under 2010. Having said that, converting to accdb/2007 seems even worse!