2

I use

qbxmlrp.getcurrentcompanyfilename

(using qbxmlrp2) in QB 2011, 2012, and 2013 (sometimes) I get error 2147220470 and the message "QuickBooks is already open and the file is different from the one requested, or there are multiple instances of QuickBooks running."

Some of the users have reported the errors began after opening multiple QB files simultaneously via Windows explorer.

Is this because of the use of Windows Explorer to open the .qbw file directly? How do overcome or code around it?

Jarred Keneally
  • 1,931
  • 11
  • 12
BobGinn
  • 21
  • 1

2 Answers2

3

This error:

QuickBooks is already open and the file is different from the one requested, or there are multiple instances of QuickBooks running.

Pretty much explains exactly what the problem is. Due to the way QuickBooks itself is designed, API/SDK connections do not work if:

  • your app tries to open a different QuickBooks file than is already open
  • there are multiple QuickBooks company files open at one time

There is no work-around, it's a limitation of QuickBooks itself.

If your app needs to communicate with QuickBooks, then the end-user needs to either have no QuickBooks company files open, or the company file that you're trying to connect to open.

Keith Palmer Jr.
  • 27,666
  • 16
  • 68
  • 105
  • 1
    Not an answer, I'm afraid. No. 1 - this app has been working for eight years until recently; there is one QB file open, which I ask QB for the name (and path). I get nothing - no trappable error, either. This is a glitch. There are 2 QBw32.exe instances running in Windows' task mgr when the user closes QB, or before it has been launched after reboot. Many users also have no error, btw. – BobGinn Apr 20 '13 at 17:09
  • I think I found it; seems to be from beginsession, not getcurrentcompanyname; without trappable errors being returned it's guesswork until I fix it. Thanks for your attempt at helping. – BobGinn Apr 20 '13 at 17:39
0

The problem was the error number returned for the wrong file name is the same as the number returned when multiple instances of QuickBooks are running - I can't tell which is occurring. Combine this with path aliases of Win7 sometimes changing intermittently and you get confusion and complex error handling code requirements. In short, if others need to store both file and path of linked QB files, I suggest allowing aliases.

BobGinn
  • 21
  • 1