Knowledgebase: TroubleShooting
[QODBC-Desktop] Troubleshooting - How to use QODBC with multiple QuickBooks Company file
Posted by Jack - QODBC Support on 28 August 2015 09:34 AM

Troubleshooting - How to use QODBC with multiple QuickBooks Company file

Problem Description:

I have a question about setting ODBC to auto-login. I am trying to automate some tasks and wanted to auto-login. We have two different company files for accounting purposes. If I set the path in the odbc to the company file, how do I change this to access the second company?

Solutions:

There is a limitation with the QuickBooks SDK: it can connect only one company file simultaneously on a machine. QODBC uses QuickBooks SDK & QRemoteServer uses QODBC, thus, so you can open one company file at a time on a device.

You can create multiple DSN pointing to different company files and use this DSN in your configuration.

Please refer to the steps below for creating multiple DSN pointing to different company files.

1) Create a new DSN.

For example, You have Company file "A," and let us create DSN for Company "A" with the DSN name "CompA." Please refer below-mentioned article for creating DSN:

How to make or configure a QODBC DSN

2) Set up auto login to QuickBooks using QODBC.

Please refer below-mentioned article for configuring auto-login to QuickBooks using QODBC.

How to set up QODBC Driver to auto-connect to QuickBooks (Video).

How to set up QODBC for auto-login into QuickBooks.

Let us repeat steps 1 & 2 for Company file "B."

1) Create a new DSN.

Create DSN for Company "B" with DSN name "CompB." Please refer below-mentioned article for creating DSN:

How to make or configure a QODBC DSN

2) Set up auto login to QuickBooks using QODBC.

Please refer below-mentioned article for configuring auto-login to QuickBooks using QODBC.

How to set up QODBC Driver to auto-connect to QuickBooks (Video).

How to set up QODBC for auto-login into QuickBooks.

Use DSN in Applications:

We have created multiple DSN. Now we use it in our application.

In this example, I am using DSN in VBA code. Please refer to sample code for using multiple DSN in VBA through QODBC:

Public Sub Test()

Const adopt static = 3

Const adLockOptimistic = 3

Dim oConnection

Dim sConnectString

sConnectString = "DSN=CompA;OLE DB Services=-2;"

// Write your query here as per your requirements. //

Set oConnection = CreateObject("ADODB.Connection")

oConnection.Open sConnectString

oConnection.Close

Set oConnection = Nothing

Sleep(10)

sConnectString = "DSN=CompB;OLE DB Services=-2;"

// Write your query here as per your requirements. //

Set oConnection = CreateObject("ADODB.Connection")

oConnection.Open sConnectString

oConnection.Close

Set oConnection = Nothing

Sleep(10)

End Sub

 

Keywords: qb win log with multiple companies, log in with multiple companies 

(0 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please complete the captcha below (we use this to prevent automated submissions).