Member Login

Username
Password
Forget Password
New Sign Up
Search Forum

Buy Support
Incidents

If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:

Click Here
If you can't login and post questions or you are having trouble viewing forum posts:
Click Here
Callback
Support

If you live in USA, UK, Canada, Australia or New Zealand, you can leave us details on your question and request us to call you back and discuss them with you personally  (charges apply).

Click Here
 
Buy Support
Incidents
If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:
Click Here

Forum : Mulitple DB ConnectionsSearch Forum

Forum Home > QODBC - ODBC Driver for QuickBooks > QODBC SQL Support Forum

 New Topic 
 
 Post Reply 
[1]  
 Mulitple DB Connections 
 Author   Message 
  Jack Nichols 
  
 Group: Members 
 Posts: 14 
 Joined: 2006-06-01 
 Profile
 Posted : 2006-07-21 06:38:27

I am writing a COM object that needs to update multiple Quick Books database files (about 20). It seems the first connection allways works, but when it tries to connect to the next Quick Books database file it fails with the following message: Error = 8004040a, A QuickBooks company data file is already open and it is different from the one. What is the syntax to properly close the file.

I am using the following to close the connection:

If Not m_adoConnection Is Nothing Then
  If m_adoConnection.State Then
    m_adoConnection.Close
  End If
  Set m_adoConnection = Nothing
End If 

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2006-07-21 08:25:42

QuickBooks needs to be working in background mode (auto-login mode) and you need to allow a delay for QuickBooks to close before you can reopen the connection with another company file. The delay time will depend on the size of the company file and the speed of the computer.

 

  Top 
  Jack Nichols 
  
 Group: Members 
 Posts: 14 
 Joined: 2006-06-01 
 Profile
 Posted : 2006-07-22 05:29:55
I put a delay of x in the code and tried values of x from 1000 ms to 50000 ms when changing database connections ... still refuses to connect to the second db. If I open the databases (one after another) using the Quick Books application, close the files, then run my app everything is fine. When I reboot the same thing happens ... the second app refuses to connect. I tried using the IBiz Integrator. The IBiz Integrator appeared solve/mask the connection issue. When I run my code with DSN's configured to use the IBiz Integrator, all of the code seems to execute fine (no connection error messages), however when I look at the invoice's that were to be created, only the first database got invoices; the second database got nothing. I have tried the following modes Single/Multi/Company; Nothing works. 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2006-07-22 09:46:21

You do understand that QuickBooks needs to be closed (not running already) for this to work?

See: How do I setup QODBC to auto-login into QuickBooks and start it if it's not running? for more.

 

  Top 
  Jack Nichols 
  
 Group: Members 
 Posts: 14 
 Joined: 2006-06-01 
 Profile
 Posted : 2006-07-25 01:04:56

I added code to check if QBXMLR~1.exe is running before moving to another db. When QBXMLR~1.exe stops running, my timer starts; then I connect to the next db. This helped, however, this leads me to the next problem. With Quick Books completely closed (tried rebooting, killing all QB tasks ect.), the Quick Books application opens up with reminder prompts and another prompt that says "The company file cannot be closed at this time because there is another application (FLEXQuarters QODBC) which is using it ...  When I get the "The company file cannot be closed ..." prompt, my process then hangs until the prompt has been clicked. After clicking the prompt, my process continues successfuly.

My QODBC Advanced Settings (in all of my QB databases) are as follows: 

  • Use Case Sensitive RefNumber Searches -> Checked
  • Include Raw Files -> Not Checked
  • Run 2.1 ODBC Compatibility -> Checked
  • Simulate Transaction Support for SQL Server -> Checked
  • Launch QuickBooks UI -> Not Checked 
  • Allow QODBC to login automatically -> Checked
  • Read-Only Access -> Not Checked
  • Allow QODBC to access personal data -> Checked

Why is the Quick Books application opening up if Launch QuickBooks UI is Not Checked ?

Thanks!

 

  Top 
  Jack Nichols 
  
 Group: Members 
 Posts: 14 
 Joined: 2006-06-01 
 Profile
 Posted : 2006-07-25 01:39:21

I created a function to check if QBXMLR~1.exe is running; If it's running my process waits until it's finished, then waits an additional 10000 ms before trying to connect to the next Quick Books database. This seems to work ... I'll have to do more testing.

However, I noticed that one of the Quick Books database's opened the Quick Books application with reminder prompts when I ran my process. The reminder prompts went away but left the Quick Books application open. I then received another prompt that said the Quick Books company data file is already open ...  My process hung. I clicked the OK button on the Quick Books application and my process continued successfuly.

How can I prevent the application from opening. I have the same QODBC settings (for all my QB databases) as described in the link "How do I setup QODBC to auto-login into QuickBooks and start it if it's not running? "

Thank You

 

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2006-07-25 08:26:16

From within QuickBooks, open the company file in question, pulldown the Edit option on the top menu bar, select Preferences... and uncheck the "Show Reminders List when opening a Company file" option.

 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to