Object variable or With block variable not set - Access 2007 - ms-access

I have added the reference Microsoft Office 14.0 library to my project. But still this error often comes up.
If i restart MS access it disappears. But again if i re-open the form for execution, it again requires me to add reference and restart.
Some one pls help.
Thanks.

Google for Access Compact and repair. (probably you need a bit more than just the menu command. There is a process where you have to use a commandline to really repair your access db...

Related

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.

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.

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.

Rebuilding Access adp in Access 2007 and getting error

I'm trying to rebuild an Access adp application in Access 2007. I started with a blank database, linked the SQL Server tables I need with ODBC, and then copied over all of the forms from the original application. I then updated the data sources for the forms to go to the correct tables.
When I open one of the forms, I get the error "Syntax error in WITH OWNERACCESS OPTION declaration". This error is occurring before the Open event code is being run.
Does anyone have any ideas about how to track down where this error is coming from? Or maybe an idea of another way to do this altogether?
Thanks!
WITH OWNERACCESS OPTION makes no sense in an ADP, as it's a command for Jet SQL for use with Jet user-level security. With an ADP, the security should all be set on the server. So, you should remove all the WITH OWNERACCESS OPTION statements from your form RecordSources.
Frankly, I'm not sure they have an effect in anything other than a saved QueryDef, so likely they were an error in the original application.
Also, I would never recommend copying anything from an MDB into an ADP. First off, I don't believe migrating to an ADP is ever advisable (though I certainly use ADPs as an administrative tool with my MDB/ODBC apps that use SQL Server), but secondly, there are so many differences between the two platforms that I just can't see them working.
If I chose to migrate an MDB to ADP (and I can't imagine that I ever would, given that MS has been deprecating ADPs for about half a decade now), I would start from scratch and rebuild it from the ground up.

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