Question

Using an application written in vb.net and using qbfc8 to connect into QB Enterprise 11. I am making a simple call to the company file to open and then close a connection. This should result in the QB application popping up a message asking if this application is allowed to have access to this file and then I am able to assign it to a specific user to sign in as.

This all works great except on this one particular server where I have yet to get it to ever popup the application request to access QBs. An error is always returned saying, "A QuickBooks company data file is already open and it is different from the one requested." with an error code of -2147220470.

I am using these instructions to access the file: http://support.quickbooks.intuit.com/support/pages/inproducthelp/Core/QB2K12/ContentPackage/Verticals/Retail/rr_sdkapp_access_preferences.html

Also I am in single-user mode while doing this: http://support.quickbooks.intuit.com/support/articles/SLN41168

On this server there are a few QB files but none of them should be being used right now, but is there a way to find out if there are any QB files being accessed on the server that is keeping the popup from appearing?

Thanks a ton!

Was it helpful?

Solution

There is not a direct way that I know of to see what company file is currently open (if any) without calling BeginSession and checking for errors. If you supply a company file name and a different company is open, you will get the "A QuickBooks company data file is already open and it is different from the one requested." error.

If you omit the company name when you call BeginSession, QuickBooks will use whatever company file is open and present the prompt(assuming the rights have not already been granted). However, if there is not a company file open, then you get an error "Could not start QuickBooks." (if QuickBooks isn't running at all), or "If the QuickBooks company data file is not open, a call to the "BeginSession" method must include the name of the data file." error if QuickBooks is open, but has no company file open.

Most programs will save the company file that they have been linked to, so they will pass the file name in their BeginSession call, and then check for the "A QuickBooks company data file is already open and it is different from the one requested." error and present the information in a clean way to the customer. For example, the QuickBooks POS software will prompt the customer if they want to continue using the old file that was setup previously, or if they want to link to the file that is currently open.

OTHER TIPS

I resolved this by installing the application connecting to the QB file on the same server. Then (this is the important part of the recipe) I changed the path from the defaulted UNC path to a local path and it magically worked. (I hate magic! If someone could explain why this happens then that would be great.)

Now that I have the integrated application authorization for this app added into the QB file I am now able to access it from other work stations using the same app and using a UNC path to point to the file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top