Database cannot open because VBA project cannot be read in MSAccess2010 file - vba

An amateur programmer has made a nice little program that works through VBA on top of a MS-Access2010 database. We are asked to make an installer for this database+VBA project. The code runs fine on any computer with Office installed, but on computers without Office we get the error above. On computers without office we install the MS-Access2010 Runtime, which is free, in order to be able to open the .accde file at all. But this does not prevent the VBA error.
I did some research on the issue but did not find anything related to this specific scenario. How can this be troubleshooted?

The problem was a version mismatch between the .accde file (sp1) and the installed ms access 2010 runtime (original) After upgrading the runtime to sp1 all was fine.

Related

VSTO Addin for Outlook won't work

I've seen tons of posts and sites that address this issue. I've tried every solution I've found but none of them work (I've been trying to figure this out for days now). I have seen many posts with the same exact sounding issue, but either the solution didn't work for me or isn't applicable. With that said...
I have an add-in for Outlook 2007 that is intended to add text to the an email's title and body. It is installed for all users using an .msi file. There is an older version that I deployed last year that works fine. The new version I created has only a few minor input/output changes, nothing major. This new version works perfectly on my development computer in both debug from Visual Studio and from an actual install. However, I can't get it to work on a non-development computer. Here are the details on the program and target computer (development computer and target computer details are the same other than the fact that the target computer doesn't have Visual Studio):
-Using Visual Studio Professional 2013
-Written in Visual Basic
-Target Framework is .NET 4.0
-The add-in is only run once the "send" button on an email is clicked.
-Outlook version is Outlook 2007
-Operating system is Windows 7 Enterprise SP1 32-bit
The problem is that the add-in won't load on the target computer(yes, I know, a bazillion other people have had the same issue). As I said previously, it works fine on my computer in both debug and installed versions. This made me think that the other computer is missing something, so I tried installing the .NET 4.0 framework onto the target computer but it told me that it was already installed. I ran through everything I could think of to get it to work with no avail. Here's how it behaves:
-Installs fine with no errors.
-HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Office/Outlook/Addins/EmailMarkTool/LoadBehavior = 3 after installation.
-VSTO_LOGALERTS = 1
-VSTO_SUPPRESSDISPLAYALERTS = 0
-Outlook opens with no apparent errors.
-LoadBehavior = 0 immediately after Outlook is opened.
-Shows up in the Add-ins under "Inactive Application Add-ins."
-Never shows up under "Disabled Add-ins."
-In the "COM Add-Ins" dialog where I can check which add-ins to use, it shows the correct directory and the Load Behavior is "Unloaded."
-The add-in can be checked. When I click "OK" I don't get any errors. When I go back to the Add-ins, it is unchecked and "Unloaded" again.
-Setting the LoadBehavior to 3 doesn't help because it goes back to 0 as soon as Outlook is started again.
-I inserted a try-catch block into the New() function of the add-in that has a MsgBox pop-up and a Throw.
-I get absolutely no errors anywhere.
-No log file is generated.
I have tried uninstalling, rebuilding, and reinstalling multiple times all with the same result. I just can't figure out why it will work on my development computer but not the target computer. Thanks for reading all of this. I know it's a lot, but I needed to get the details out. Thanks in advance for any input!
[UPDATE]: I just created a brand new minimal add-in just to test if it would work but got the same results.
I found the problem!
The problem may be unique to Outlook 2007. It turns out Microsoft Office 2007 SP1 and SP2 had a bug that prevented it from running VSTO addins. Microsoft released a hotfix that fixes this issue (https://support.microsoft.com/en-us/kb/976477). This was added in to the release of Microsoft Office SP3. However, to activate the fix, a new registry flag must be created but that isn't automatically done with the fix, making the fix useless until you manually activate it (instructions and download here). So...
To enable VSTO addins in Outlook 2007, you have to add a subkey to this registry: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\Common\General\
and add a DWORD "EnableLocalMachineVSTO" with the value set to 1.
I did this, restarted the computer for good measure, installed my addin for the 23rd time, and it installed and ran perfectly! I'm not sure how previous versions worked, though. It's possible that our system admins removed that subkey in an effort to bolster security at some point.
The loadbehaviour key problem you are experiencing is strange. Whilst I think this is probably not your solution, it could be, so its worth a try.
The target computer will need to have VSTO tools for office runtime installed.
You can download these tools are the following link - https://www.microsoft.com/en-GB/download/details.aspx?id=48217

Visual Studio Tools for Office VSTO "customization assembly could not be found or could not be loaded"

I just installed Visual Studio 2012 Ultimate and I am trying to create a managed code extension project for Excel 2010 (32 bit Office Professional Plus). I have tried using the .NET 4.0 template contained in VS Ultimate for an Excel 2010 workbook. When I create the project everything looks fine until I run it.
Excel opens and I get the error message "The customization assembly could not be found or could not be loaded. You can still edit and save the document. Contact your administrator or the author of this document for further assistance." The details section is blank.
I have tried everything I could think of to figure this out and I have run out of ideas. I removed all addins from Excel except for the VSTO Design-Time Adaptor for Excel. I removed all personal macros. I set every directory I could think of to "trusted" in Excel and lowered the security settings for all options to "enabled (not recommended)". I completely uninstalled Visual Studio and re-installed. There are no errors or warnings showing up in Visual Studio. I also checked to make sure ".NET Programmability Support" was installed for my copy of Microsoft Excel.
I would link my code but I haven't written anything. I can't even get the default template to load when I run the project. A few others at work have the same setup as me and VSTO runs fine for them using the same steps. I even had someone send me a working project but it gives me the same message when I try to run it.
Is there anything else I can check to see where the problem is occurring? I tried setting break points in the project but it is failing before it gets to any of them.
Thanks so much for your help.
I've run into the same problem with Visual Studio 2010.
I isolated the problem to an SSRS reporting link we were trying to run from the add-in. I removed all the reporting stuff (service reference, sub-dirs, etc.) - the add-in runs fine.
We just ran into this and discovered that a method had a system exception that was not handled. It was hard to track down but once the culprit method had an exception handler the customization finished loading properly.

Adding Office 2010 Interop (PIA) in Visual Studio 2012

I am writing an application in VB.NET that will send emails using outlook. My problem is that I need the Office 2010 PIA to do this. The following are the steps I have already tried (I am using Visual Studio Express 2012):
Restarted the machine
Downloaded Office 2010 PIARedist and installed it
Restarted Visual Studio
Restarted the machine again
Uninstalled Office and the PIA and re-installed Office, making sure that the PIA was selected in the installation options (it was already selected by default, so presumably I installed it the first time I installed Office as well).
Restarted the machine again
Downloaded Office 2010 PIARedist and installed it again
Restarted VS
After each of these steps, the PIA is still not available in "Add Reference" in VS, nor do the files exist on my computer at all (a search for "Microsoft.Office.Interop.Outlook.dll" confirms this). I am running Windows 7 on my MacBook Pro. Does anyone know what my problem is here? This seems like a ridiculous amount of headache for such a simple feature.
PS The only reason I need the PIA is to be able to add CC recipients on the email. That's it. If anyone knows how to do that without the PIA, please let me know because I'd much rather just do that and be done with it.
PSS Both times when I installed the PIA itself, the installation ended silently (no indication of success or failure).
In case anyone stumbles on this question, I finally figured out how to add the interop. For some reason, it won't show up in the "Add References" window (maybe it's because I have VS2012 (11.0) and I'm using Office 2010...?) Anyway, I had to manually browse to it to add it. It was located in C:\Windows\assembly (all of the Office 2010 interops were in there). Also interesting was that a search of the entire C drive for 'Microsoft.Office.Interop.Outlook' or shortened versions of that string turned up absolutely no results, even though they are on the drive. One last note: although 'Microsoft Office 14.0 Object Library' shows up in the "Add References" window, adding that reference did not allow access to the interop.

Excel Interop Assembly Error 80040154 in VB.NET

For the visual folks:
And at line 61:
Everything I'm finding on the web is one of 3 solutions for the problem:
The user is trying to use an interop assembly without Excel installed. I have M$ office pro 2010 installed. So that's not the issue.
I'm not typing it out but you can look here
Users are running the interop assembly in 64-bit, I'm on a 32 bit machine. So that's unrelated. But I did try compiling as 32bit only instead of Any CPU. Didn't help.
Basically fix #2 is for those running this code on a server and their code is executing under the ASP user account, in my case its a desktop app so this should be unrelated but in desperation I added "Everyone" to the permissions and gave them all privileges. Didn't work.
So now I'm turning to here. Any questions, comments, concerns?

MS Access: Can't complete the Output operation

I'm not an experienced vba programmer and working with access is not my cup of tea. I've been asked to fix some errors in an MS Access 2010 VB application. The sole user previously ran the application on a 32-bit platform but now has migrated to 64-bit. This caused the aplication to break. I have made some progress but every issue I resolve another seems to appear.
The following piece of code
DoCmd.OutputTo acOutputReport, "rptQLDExport", acFormatRTF, frm.txtDirectory.Value + "\QLD\All\QDATA.DOC"
is causing a runtime error 2587: Microsoft Access can't complete the Output operation
I have seached on the net for an answer but to no avail.
My development environment is Windows 7 SP1 (64-bit) and the application is running in Access 2010 (vba7, 64-bit). I'm willing answer questions to provide more information. Any suggestion will be appreciated.
This forum post suggests it is related to runtime versus full versions of Access (or Office). The suggested solution is to Copy the file UTILITY.ACCDA from the ACCWIZ directory to the same directory as MSACCESS.EXE
You would need to check licensing before distributing the file in your application installer, obviously.
Update: On a machine that fails, copy over ProcessMonitor (from technet; no install required). Filter to your application. Repeat the process and get it to fail. Examine the files that your application is trying to access and why they fail.