Question

Q: Microsoft Access error 3151 database connection failed

We have an access database that uses the QuickBooks QODBC driver to link to the QuickBooks database to dump data out of. It has worked fine without issues all year. It has suddenly produced an error

Error: 3151 Connection to Quickbooks data failed

This is the line the code fails on:

DoCmd.TransferDatabase acImport, "ODBC", "ODBC;DSN=QuickBooks Data;SERVER=QODBC;OptimizerDBFolder=C:\Program Files\QODBC Driver for QuickBooks\Optimizer;TABLE=" & sQBTblName, acTable, sQBTblName, sQBTblName, False

Nothing on the local network has changed, nothing on the access dbase has changed, Quickbooks and driver has not been updated.

Access 2010, Windows 7 64 bit

The only thing that I can see that is different is that a microsoft update happened (approx Jan 14) . We did a system restore to 4 days prior and it all worked fine. Then it fell over again.

[BTW, the microsoft update on Jan 6th made our excel macros fail but we found a fix for that.]

Do you know whether this would have had an impact and if so what needs to change?

Many thanks for you help!



Still needing help with this! Thanks.

Did this solve your problem?

Sorry this didn't help.


Hi Linda, 

I spent an hour researching and modifying resources because I was having a similar problem as you.

Here were the steps taken by me to achieve my successful end result:

----Get connection information via conventional import steps------

1) (in MS Access) External Data->ODBC Database->Import the source data into a new table in the current database->Find your quickbooks Company File (note: if it does not have .dsn at the end, type it in manually in the the DSN Name field before you click ok to open the file.)->supply your username and password (note, this is not a standard user id and password! in quickbooks, navigate to Reports->Custom Reports-> ODBC, and set up a user)

2) Upon successful login, you will see a list of QB Tables.  Choose any table from QBReportAdminGroup, table does not matter, because we will be getting the connection info from this import.

 optional: take note of specific tables you want.

3) Click ok and SAVE IMPORT STEPS

4) Navigate:  External Data -> Saved Imports -> Find the recent saved import but dont run it.

5) If you click on all that mumble jumble on the right side it will enable the text box and allow you to copy it, select everything in this box and copy to clipboard, then close the window.

Now, the vba code will look like this:

DoCmd.TransferDatabase acImport, "ODBC", "PASTE FROM CLIPBOARD CTL-V", _

acTable, THE LAST PART OF THE TABLE YOU WANT ie "v_lst_item", NAME OF THE NEW TABLE, _

FALSE, TRUE

LAST STEP:  in the information that you pasted into this command, you will see a part that says EncryptedPassword=NUMBERS;

Type this before that:   UID='USERNAME YOU SET UP EARLIER';

Mine looks like this:

DoCmd.TransferDatabase acImport, "ODBC", "ODBC;Driver={QB SQL Anywhere};DatabaseName=0775981f2e7e4c5c86f96b54698d590d;UID='QODBC';EncryptedPassword=19e183137dc8fd51d7;Debug=NO;DisableMultiRowFetch=NO;CommLink;ServerName=QB_APP_SERVER_25;AutoStop=NO;Integrated=NO;FILEDSN='Q:\Super Bird Creations, LLC.qbw.dsn'", acTable, "v_lst_item", "QBReportAdminGroup_v_lst_item", False, True

This will allow you to import a table without having to enter credentials every time!

If you need more information, feel free to email me at:

*** Email address is removed for privacy ***

Did this solve your problem?

Sorry this didn't help.


 
Question Info

Views: 1,479 Last updated: May 14, 2018 Applies to: