Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello: I am trying to send a pas

Status
Not open for further replies.

mgkSHA

Programmer
Jul 12, 2002
126
US
Hello:

I am trying to send a pass-through Query via two Access mdbs. I typically use only VB 6.0 for all of my OBDC/DSN connections, so I am not sure what the differences are exactly when doing an Access-to-Access connection versus an ODBC/ADO VB 6.0 dbs.open ("DSN=name") call.

Via this code, the query is passed and the code does not throw any errors. But, when I try to open the Query I get the error message:

ODBC - - Connection to 'Switch' Failed.
Can anyone help me pass this query? It seems my ODBC statement in Access is not correct. Please advice :).

Martin K

CODE:

Private Sub Command55_Click()
Dim dbsCurrent As Database
Dim qdfPass As QueryDef
Dim StrMsg As String

Set dbsCurrent = OpenDatabase("M:\OOTSSwitch")
Set qdfPass = dbsCurrent.CreateQueryDef("TestData")
qdfPass.Connect = "ODBC;DSN=Switch"
qdfPass.SQL = "Select * from CallData where Office = 'OOTS'"
qdfPass.ReturnsRecords = True
dbsCurrent.Close

StrMsg = "A connection was created."
MsgBox (StrMsg), vbInformation



End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top