All forms and code vanished from Access database - ms-access

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.

Related

The database cannot be opened because the VBA cannot be read

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.

2010 Access Runtime - Missing functions for 2007 users?

I have an Access database for which I have created a 2010 runtime version.
I sent over to a partner in India where their predominant machines only have Access 2007 installed.
They have installed Access 2010 Runtime to these machines, but make the following claims:
No access to Nav Pane - to see/open tables
No menu ribbon
No table/datasheet right-click functions (sort, find, etc.), except as I have implemented under buttons on the form.
I see all these functions when I run on a 2010 VM. I don;t have a 2007-only machine to validate or debug their claims.
Does this result sound odd?
I suppose I could work around some of these:
Populate the current list of tables in a listbox on the form
Create a custom menu with the necessary functions
Not too sure about the table/datasheet right click functions
Not freaking out just yet, but getting close... I cannot re-build this thing DOWN to 2007.
Any advice anyone?
Does this result sound odd?
Not really. It sounds like you were opening the .accde file using the full Access 2010 application while the other team was opening it using the Access 2010 Runtime.
The Access 2010 Runtime environment does not include things like the standard ribbons, navigation pane, etc.. If the developer intends to deploy the Access application under the Runtime then the expectation is that they will provide custom ribbons and navigation tools as required for that particular application.
Note that this is true whether the Access application is distributed as an .accdb file or an .accde file. An .accde file is simply an .accdb file with the VBA source code removed and the users being prevented from opening objects like Forms and Reports in Design View. Those changes help "lock down" an application when opened in the full Access application, but they don't make any difference to the behaviour when opened in the Runtime environment (because the users can't perform those operations in the Runtime environment anyway).
Developers can test the "Runtime" behaviour of their applications by opening them in "Runtime mode" in the full Access application. This can be accomplished in either of the following ways:
Create a shortcut that invokes MSACCESS.EXE with the /runtime switch and passes the name of the .accdb file to open.
Temporarily rename the .accdb file to .accdr and open it. .accdr files automatically open in Runtime mode.

MS Access Issue - VBA Editor appears during runtime

I am about to release an Access Database application where the UI is used exclusively to interact with the database tables.
Whilst I am interacting with the forms during run time, the Visual Basic Editor appears with a line of code highlighted in debug mode, even when no breakpoints exist and no run time error has occurred.
Has anyone else come across this issue?
I need to ensure that the editor does not appear (under normal operating conditions) while the user is interacting with the application.
Thanks.
Yes, I have had this problem too and it has driven me batty. The quick and dirty way of fixing it is to create blank database and import all of the objects from you old database into the new one.
Are your users working with an .accdb file? (or .mdb, depending on the Access version)
If yes, you should convert it into an .accde/.mde before giving it to your users.
Quote from the link:
Additionally, if the database design needs to be secured to prevent changes, Access databases can be locked/protected (and the source code compiled) by converting the database to a .MDE file. All changes to the VBA project (modules, forms, or reports) need to be made to the original MDB and then reconverted to MDE. In Access 2007 and Access 2010, the ACCDB database is converted to an ACCDE file. Some tools are available for unlocking and "decompiling", although certain elements including original VBA comments and formatting are normally irretrievable.
--> since .accde/.mde files are compiled, it's not possible to view the source code at all.
So the VBA editor can never appear accidentally like you experienced...be it because of a breakpoint, some Stops in the code or some strange breakpoint error like yours.

Access 2007/2010 Source Control

I'm using the Access Developer Extensions to attempt to source control this access database in TFS, however, I'm not sure I am doing it right. I can add a .mdb to source control and create a database from that source control.
I'm probably making a stupid mistake, but I can't figure out how to close the database I created from source control and reopen it while it's still under source.
Does anyone know of any tips or guides on this? I've searched for help on Access Developer Extentsions but I haven't found much. Thanks in advance guys!
I think I found what I was doing wrong. My database automatically compacts on close, so when it tried to do this Access asked me if I wanted "to remove the compacted database from source control". I thought this meant it would just not store the .mdb file, but still keep the objects (like tables, vba, queries, forms, etc) under source. However, this appears to completely remove it... from MSDN:
"Changes to Microsoft Access Behavior
Using the Compact Database Command
In order to take a database that is under source code control and deliver it to a user, you need a way to cut the database's ties to source code control. When you compact a database that is under source code control, Microsoft Access 2000 prompts you to remove the database from source code control.
To remove the database from source code control, Microsoft Access simply removes the Visual SourceSafe properties from the Microsoft Access database and its objects."
http://msdn.microsoft.com/en-us/library/aa155494(v=office.10).aspx
When I said do not remove compacted database from source control, my database and it's objects stayed under source.

MS Access 2010: "collating sequence not supported with the specified file format"

I recently upgraded to MS Access 2010. When I open a certain .mdb (2000-2003 file format), I am greeted with this message: collating sequence not supported with the specified file format. I'm not sure what it means, but it gives it to me every time the database is opened.
I have Googled around but found nothing that I thought seemed related. If I upgraded the file format to 2007 it didn't give me the message but that isn't much of an option in this situation.
Is this a 2010 issue? or is there something corrupted with my database? What do I need to do to work around it?
I had the same problem and found a different solution. I am using ms-access 2010 and 2007. 2010 could not create mdb files and the accdb files it created would not open in 2007. The solution was to go to the File tab in 2010, click the options link and set the sort order for new databases to 'General - legacy'. The sort order that was displayed was 'General' I then created a blank database in mdb format and imported all the objects, forms, code et. The newly rebirthed database works in 2007.
This KB article by M$ fixed my problem. The issue was the "new database sort order" setting.
I encountered this error after enabling the Track name AutoCorrect info option for a database originally created in Access 2007 then later upgraded to the 2010 file format. I'm now using it in Access 2016.
In my case, contrary to the resolution provided by the Microsoft KB article referenced by #Icode4food's answer the solution was to change the new database sort order to "General - Legacy".
Additionally, this database is configured to automatically perform a Compact & Repair upon exit. For some reason this caused the sort order to revert back to General. Therefore the exact steps I had to take to solve the problem are as follows:
Change New database sort order setting to General - Legacy.
Close database. Cancel automatic Compact & Repair by pressing ESC.
Re-open database and confirm sort is is still set to General - Legacy.
I also faced similar issue, I had MS-Access file created on one machine. And I shifted my web server to another machine. And I started getting the similar exception.
I just created a new MS-Access DB on new machine and copied all the tables (with data) from old db.
And using the new DB file fixed my problem.
Cheers!
Backup. Make a backup copy of the bad database, without overwriting any existing backups. Whatever has gone wrong, you don't want to make it worse, and a backup gives you multiple attempts at recovery.
Uncheck the Name AutoCorrect boxes.
In Access 2007: Office Button | Access Options | Current Database.
In previous versions: Tools | Options | General.
For an explanation of why, see Failures caused by Name Auto-Correct.
Compact.
In Access 2010: Compact and Repair Database on the Database Tools ribbon.
In Access 2007: Office Button | Manage | Compact/Repair.
In previous versions: Tools | Database Utilities | Compact/Repair.
Decompile. Close Access, and enter something like this at the command prompt:
Use the path to where msaccess.exe is found on your computer, and include the quotes.
Compact again.
Open Access (holding down the Shift key if you have any startup code), and compact again.
Do this twice: one comp