Cannot run certain queries in MS Access - ms-access

The Problem
I have been encountering a problem with MSAccess 2007, with a 2003 format database.
When I try to run the query (for example a select query), I get the message "The Microsoft Office Access database engine cannot open or write to the file "query name". It is already opened exclusively by another user or you need permission to view and write its data".
In addition, I cannot view the query in design view, only in SQL view. This only happens for certain queries, which I was previously able to design and change with no issues.
What I have tried
I have tried Repairing and Compacting, and that does not fix the problem. The only way I have been able to fix so far is by importing all the objects into a new database, which has resolved the problem for a while, then a few days later the same issue happens again.

If you are in a multi-user environment, and the back end database is on a share drive, this will happen when someone else opens the back end database directly from the shared drive instead of using the local front end database. If the back end database is opened directly from the shared drive, other users will be unable to use the front end database due to locking issues.

Related

unrecognized database format access 2007 split database

I have an MS Access 2007 split database. The Back End database contains 1 table. It is on a shared drive and front end has a data entry form with Macros, also a linked table from back end. Everyone in the organization has same version of Access (2007), same operating system etc.
Problem is I am able to open and add records to the front end but when anyone else try to open the front end it comes up with "Unrecognized database format" and they couldn't open it.
So far tried changing New database sort order to general - Legacy/ Compact and repair database from database tools but still not working for other users. Almost spent half a day searching and trying various solutions without success. Any help into right direction will be highly appreciated.
The lock file got corrupted. Delete it and re-open the application.

Access err 2004 - out of memory

I have several clients that I make databases for, all are pretty similar... They all have a screen with current data displayed. This screen/pc combo also sends some emails, uploads data, etc... usually without problems... however, one client keeps getting an 2004 (Not enough memory) and 3035 (system resources exceeded). I have tracked the memory usage on the device and it hasn't gone about 50%. I ran a memory test and no errors were found.
Today, I notice the error and was able to try a few things. With Access open, I could not open or design view any forms. Some queries I could get to open to SQL, but not design view. Crosstab queries would not open in design or SQL. Neither would open and show any data.
These errors are usually logged, and I will get several 2004s in a row, then it will switch to several 3035s, then eventually it will just quit altogether. Closing Access and reopening will always fix it (for a while).
I have decompiled and recompiled. I have tried accdb and accde versions. This is Access 2007. What should I try next?
Can't add as comment, but one thing to try would be to check the service pack level for Access, the latest for Office 2007 is SP3.
Also, if the issue is with multiple forms, then it could indicate database corruption rather than issues with individual forms. Have you tried to import all objects into a brand new container and run it from that?

Access "repair" breaks a slightly complex query

I have an application that creates an Jet database at run-time, and imports ~100k records so that I can make use of the indexing for performance reasons (1 minute versus nearly 10 when not using a Jet database).
The database is created using ADO Extensibility in Excel, and everything works just fine. However, my issue comes whenever I then open the MDB file in Access front-end, it automatically starts to "repair" the database.
The data is still fine after the "repair", however my main output query can not then be viewed in Access as it tells me it cannot represent the joins, and if I then view it in SQL the required joins are not there, and the query can no longer run. This still happens if I let it get "repaired" but do not open that query, i.e. it is the "repair" that breaks the query, not the act of trying to view it in Access. The funny thing about this is that I used the Access GUI query designer to construct the SQL as my life is too short to worry about it's crazy bracketing style, but it then later decides that it's too complex for itself??
Also, nothing else appears to be affected so I can only assume it's this one query it doesn't like.
This isn't a deal-breaker for me as my fix is to make the MDB hidden and advise users who can see it not to open it.
However, I would really like it if the database could be opened and I didn't have to hide it away like that. Therefore, my question is whether there is any way to prevent the MDB being "repaired" automatically?
Thanks!
Microsoft Access is "repairing" the file when opened because it is missing some tables that are specific to the Microsoft Access user interface. Since you created the MDB file directly using OLEDB with Microsoft.ACE.OLEDB.12.0, these tables are not present, and must be created when Access opens the MDB the first time. There are several ways you can circumvent this:
1) Name the MDB something other than .mdb - e.g.: MyAccessDatabase.mad - this will prevent Windows from using Microsoft Access to open the file.
2) Use COM+ to open an instance of Microsoft Access, and have it create the .MDB file. This .MDB file will then have all the necessary tables present and will not need to repair the file.
FYI, whenever Microsoft Access opens an MDB that needs repairing in this fashion, it will inspect all the QueryDef objects for invalid SQL and correct them as necessary. This is why your "complex" query is breaking.

Record-Locking in Access 10

I am using MS Access 10 in a multi-user environment. The DB is split with tables in the back end (stored on a network drive), and everything else in the front-end (stored on about five different computers).
Some of the front-end computers are using Access 07, but the DBs were created in the 07 format. I have checked that the database is NOT using the 2010 encryption, and all the other 10 settings that are not compatible with 07. In fact, the 07 computers will run the DB just fine when alone... the problem is when more than one person logs into the DB.
Often there is a "Too Many Active Users" error when trying to sign in. Other times, users are able to log-in and open forms, but whenever changes are made we get "locked" errors. (This happens on all computers, not just the ones running 07).
All the DB copies have record-level locking, but it behaves as if it is locking the entire table. I have checked, and none open the DB in "exclusive" mode. (When you go to the navigation pane, and open the table, the table itself will not allow new entries).
I have tried creating the forms based on queries and also with filters instead. I get the same locking problems either way (Does anyone know if queries or filters lock data differently?).
This is forcing the DB to be used by one user at a time, when multiple people need access. Is there anything I am overlooking? All have permissions set to the network drive, I removed the "compact on close", I tried converting to an ACCDE file (the ACCDE file will not open in 07, only 10, but we get the same locking errors).
Can anyone think of what I might be missing here?

Could not use '(unknown)'; file already in use

We have the problem, which I think should be easily resolvable, but just not sure how.
We have the Windows 2003 Server with the Classic ASP application on it. The MSAccess database is used for data storage.
The application is designed in the way that it has a lot of includes.
The .asp page may open the DB connection and close it in the end of the page. At the same time the include that is included on the page may have the same database open as well.
The problem is that on the second open we're getting an error:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver] Could not use '(unknown)'; file already in use
This is on our local configuration only - we don't own that project, but are helping customer to fix some items. Everything works just perfect on Customer side.
When we set the read-only access to the database this error is not shown.
So, it seems that the ADODB.Connection is opening the database in exclusive mode.
Anyone has any ideas how to fix that?
Thanks
Ok. The issue was resolved. As I was saying in the question - the resolution was VERY SIMPLE. Instead of setting the IUSR_* Write permission to MDB file only, it was necessary to set the Write permission to the whole folder where the MDB file is stored. Strange, because I don't see any additional files created (meaning, like .ldb file, which is created during an exclusive DB open). But, it works now!
As far as I remember from using Access in my first classic ASP days you can't have more than one connection opened in the same time pointing to the same physical .mdb file because once it's opened, it's locked. That's what I learned the hard way.
The solution for me was using one single Connection. Having very small website to manage, I just used Application level connection object, created and opened once in global.asa then used in all pages.
However this is not good for ordinary websites so you can write file called "database.asp" in there create and open the connection then include that file and use the connection object in your code, not forgetting to close it in the end of every page.
Hope this makes sense, I'll clarify if needed.