ODBC Call Failed with complete Connect string but not with ODBC only.

G

Guest

I have created a pass-through query between MS Access and an SQL Serverwith statements like

Set qdfPassThrough = dbs.CreateQueryDef("Duplicates"
qdfPassThrough.Connect = "ODBC;DATABASE=DBSQL;UID=sa;PWD=;DSN=Famous
qdfPassThrough.SQL = strQuery (i.e., the SQL statement as a string
qdfPassThrough.ReturnsRecords = Tru

Upon execution I receive the error: ODBC call failed (apparently #3151)

The odd thing is that when I reduce the Connect statement to just "ODBC;" and execute it, it will prompt me for the DSN, UID and PWD (no password) and I provide the exact same information as displayed in the long connect statement and it all works fine

I checked the client and server named pipes and TCP/IP and everything seems to be in order. What is going on here

Thanks
 
R

Ron Weiner

Betacon

What happens when you remove DSN=Famous from your connect string?

Ron W
Betacon said:
I have created a pass-through query between MS Access and an SQL Serverwith statements like:

Set qdfPassThrough = dbs.CreateQueryDef("Duplicates")
qdfPassThrough.Connect = "ODBC;DATABASE=DBSQL;UID=sa;PWD=;DSN=Famous"
qdfPassThrough.SQL = strQuery (i.e., the SQL statement as a string)
qdfPassThrough.ReturnsRecords = True

Upon execution I receive the error: ODBC call failed (apparently #3151).

The odd thing is that when I reduce the Connect statement to just "ODBC;"
and execute it, it will prompt me for the DSN, UID and PWD (no password) and
I provide the exact same information as displayed in the long connect
statement and it all works fine.
I checked the client and server named pipes and TCP/IP and everything
seems to be in order. What is going on here?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top