Quantcast
Channel: FLEXquarters.com Limited
Viewing all articles
Browse latest Browse all 313

Troubleshooting - How to use QODBC with multiple QuickBooks Compa...

$
0
0

Troubleshooting - How to use QODBC with multiple QuickBooks Company file

Problem Description:

I have a question about setting ODBC to auto login. We have two different company files for accounting purpose. I am trying to automate some of the tasks and I wanted to auto login. 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 that it can connect only 1 company file at a time on a machine. QODBC using QuickBooks SDK & QRemoteServer uses QODBC thus you will able to open one company file at a time on a machine.

Yes, you can create multiple DSN that is pointing to different company files and use this DSN in your configuration.

Please refer below steps for creating multiple DSN that is 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 DSN name "CompA". Please refer below mentioned article for creating DSN:

How to create or configure a QODBC DSN

2) Setup auto login to QuickBooks using QODBC.

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

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

How to setup QODBC for auto-login into QuickBooks.

Let us repeat step 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 create or configure a QODBC DSN

2) Setup auto login to QuickBooks using QODBC.

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

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

How to setup 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 below sample code for using multiple DSN in VBA through QODBC:

Public Sub Test()

Const adOpenStatic = 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

 


Viewing all articles
Browse latest Browse all 313

Trending Articles