2

I support a legacy WinForms C# application that connects to 2 QuickBooks files. It has worked very well for years, both with QuickBooks 2008 and QuickBooks 2011.

A few days ago, the client upgraded to QuickBooks 2014. The application has not sucessfully connected to the QuickBooks files since. When I run the application manually it throws a .NET error saying System.Runtime.InteropServices.COMException (0x80040408): Could not start Quickbooks.

I decided to test to make sure that the SDK I am using, version 8.0, could in fact connect to QB 2014. So, I ran the SDKTestPlus3 application. When I tried to connect to the company file, it tells me that the application is not authorized to connect to that company file. So, I opened the company file in QB and went into Single User mode, and tried again - expecting to get the pop-up asking me to grant that application the right to connect. Instead, when I tried to connect with the file open in QB in Single User mode, SDKTestPlus3 gave an error saying "A QuickBooks company data file is already open and it is different from the one requested or there are multiple company files open."

Can anyone point me in the right direction here. Is the QBFC8 compatible with QB 2014, and if so is there something I need to do to get this application that has been working with QB 2011 for so long to continue working with QB 2014?

TIA!

Additional Information

I have now noticed that the errors in connecting to QhickBooks seem to be intermittent. The WinForms application gets run by a windows scheduled task every morning at 1:00 AM. Since the upgrade to 2014 on Monday, it has failed Tuesday, Wednesday and Thursday mornings. In looking at today's log files - this morning it successfully connected and processed records in QB. Now, when I try to run it manually, instead of the (0x80040408): Could not start Quickbooks COM error I instead got COM error (0x8004041C): An internal QuickBooks error occured while trying to access the QuickBooks company data file.

Has anyone else experienced these types of problems or have any idea what may be causing them? I need this application to work consistantly as it has in the past!!

bjthomps
  • 41
  • 4
  • As of today this is still a *huge* issue. Has anyone else encountered this? I would estimate the appliaction is connecting successfully maybe 50% of the time. – bjthomps May 12 '14 at 18:13

2 Answers2

0

Make sure the option to Keep QuickBooks running is unchecked.

Close all QB files that are open and make sure there are no other QBW32.exe files running in the task manager. If there are, kill them.

Try connecting again.

William Lorfing
  • 2,656
  • 10
  • 7
  • I made sure no other instances of QB were running and no QBW32.exe were running. I do not see a "Keep QuickBooks running" checkbox anywhere, where do I locate that? – bjthomps Apr 25 '14 at 14:56
  • It is in the preferences - general tab. What patch release of 2014? – William Lorfing Apr 25 '14 at 16:33
  • All it says is QB Pro 2104. I unchecked the Keep QuickBooks running option and the SDKTestPlus application still won't connect. – bjthomps Apr 25 '14 at 17:15
  • Open QuickBooks, press the F2 key, tell us what it says in the top "product" line. Hopefully it says something like "R5P" near the end of that line, which is the patch release that William is referring to. – Charlie Russell Apr 25 '14 at 23:06
  • QuickBooks Pro 2014 Release R5P – bjthomps Apr 30 '14 at 11:48
0

QuickBooks can be picky about who is doing what. Even better, though I'm sure there's some set of logical conditions that make it 100% replicable, it complains about user access seemingly randomly.

Make sure your legacy WinForms application and QuickBooks itself were installed and are running under the same user account.

Another option is altering the UAC settings.

technet on UAC: https://technet.microsoft.com/en-us/library/cc709691%28v=ws.10%29.aspx

intuit on UAC and your presenting error code: http://support.quickbooks.intuit.com/support/articles/SLN40414

Ignore that bit ^^^.

There's an error in QuickBooks Pro 2014. I've encountered it running in unattended mode with your connections and sessions going back and forth between company files.

After a few back and forths, something happens in their code and when you .EndSession/.CloseConnection the QuickBooks exe doesn't shut down. Then when you try to open your next connection, the exception bubbles up and you get the InterOp exception.

What I ended up having to do was after closing the connection, waiting like half a second and then, if QB32 is running, killing it. It's a crummy fix, but I didn't have a choice, and it works.

    // closeConnection is from Intuit's SessionManager.cs that gets installed with the SDK
    private void closeConnection(bool logError)
    {
        try
        {
            endSession(true);

            if (_bConnOpen)
            {
                _sessionMgr.CloseConnection();
                System.Threading.Thread.Sleep(waitTime);
                KillQB32W();
                _queryResponse = null;
                _bConnOpen = false;
            }
        }
        catch (Exception e)
        {
            if (logError)
                logger.logCritical("SessionManager.CloseConnection", e.Message);

            throw;
        }
    }



    private void KillQB32W()
    {
        System.Diagnostics.Process[] oProcess = System.Diagnostics.Process.GetProcessesByName("QBW32");

        foreach (System.Diagnostics.Process q in oProcess)
        {
            if (!q.HasExited)
            {
                q.Kill();
                System.Diagnostics.Debug.WriteLine("Killer");
            }

        }

    }
aape
  • 475
  • 1
  • 8
  • 24