DNS-less ODBC connection via ADO |
Author |
Message |
|
Posted : 2006-04-27 01:47:05 |
I am evaluating the product. We have about 20 company files that i am attempting to pull GL and transaction data from and put into an MS Access table for aggregate reporting purposes. So, my goal is to loop through all 20 files and append the needed data from each file to my Access table. Here is my ADO connection string:
sConnectString = "DRIVER={QODBC Driver for QuickBooks};SERVER=QODBC;DFQ=R:\Finance\QuickBooks\Company1.QBW;OpenMode=S;OLE DB Services=-2;OptimizerOn=No;"
When I run this one i get the error: "Begin Session Failed Error = 80040403 Could not open the specified Quickbooks company file."
If I open the file manually in Quickbooks and use this connecting string, everything works fine:
sConnectString = "DRIVER={QODBC Driver for QuickBooks};SERVER=QODBC;DFQ=.;OpenMode=S;OLE DB Services=-2;OptimizerOn=No;"
So my question is, how can i get the QODBC driver to open the QB file via a DNS-less connection? I would prefer bypassing DNS since that would require me to set up DNS for each QB file.
Thanks... |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-04-27 07:56:16 |
|
|
|
|
Posted : 2006-04-27 08:19:00 |
Thanks for your reply. I'd previously setup the company file for auto login so that's not the problem. I'm using QB 2006 Simple Start which only runs in Single User mode. Could that be the problem? |
|
|
|
|
Posted : 2006-04-27 08:32:02 |
No, I run in single user and multi-user modes all the time. I suggest you setup different auto-login DSN connections for each company file. If you have set it up correctly, you will be able to go into VB Demo and connect without having QuickBooks open, then close the connection, and connect using another DSN/company file etc. Once they work correctly, your DSN-less connection will work too.
Note: QuickBooks can only have one company file open at the one time. |
|
|
|
|
Posted : 2006-04-27 08:36:03 |
Maybe i'm just not getting this but i thought a dns-less connection meant i didn't have to set up dns for each company file. Do I have that wrong? Must i set up dns for each company file even when i'm attempting a dns-less connection?
Thanks |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-04-27 18:27:27 |
Sorry, you must go through authorizing each company file to use QODBC in QuickBooks. This is a QuickBooks security requirement and is a once off procedure. To do this, you must connect QODBC to each company file in the first place before using a DSN-less connection. |
|
|
|
|
Posted : 2006-04-27 22:29:15 |
The first company i attemped to connect to via dns-less connection i had previously set up dns and connected, authorized, etc. So, i got in via DNS. Then i tried the suggested dns-less connection per previous post:
sConnectString = "DRIVER={QODBC Driver for QuickBooks};SERVER=QODBC;DFQ=R:\Finance\QuickBooks\Company1.QBW;OpenMode=S;OLE DB Services=-2;OptimizerOn=No;"
It only works if i have the file open in quickbooks with DFQ=. When I set DFQ= to <my file name> as in above, that's when i get the error. So, i've done everything you've suggested i do and the dns-less connection still does not work.
Thanks... |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-04-28 08:11:05 |
I assume the error is still: "Begin Session Failed Error = 80040403 Could not open the specified Quickbooks company file"?
If so, check that "R:\Finance\QuickBooks\Company1.QBW" is the correct path and try leaving QuickBooks closed (not running). |
|
|
|