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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC Direct Syntax Problem

Status
Not open for further replies.

TimboA

MIS
Jul 12, 2001
38
0
0
GB
I'm trying to connect to an Oracle 8i Db via Acces using ODBCDirect. My code (located in a module) is :-

Sub CreateConnection()

Dim wrkODBC As Workspace
Dim ConnOracle As Connection
Dim strCon As String

' Define Connection String
strCon = "ODBC;DSN=dev;UID=scott;PWD=tiger"

'Define ODBC Workspace
Set wrkODBC = CreateWorkspace("DEV", "scott", "tiger", dbUseODBC)

'Define ODBC Connection
Set ConnOracle = wrkODBC.OpenConnection("DEV", dbDriverComplete + dbRunAsync, False, strCon)

MsgBox "Connection Made to" & dsn

End Sub

However, when I try and run this, the program errors on the
Set ConnOracle = wrkODBC.OpenConnection("DEV", dbDriverComplete + dbRunAsync, False, strCon) line. The error is "Run-time error 13: Type Mismatch".

Can anyone see what I'm doing wrong (or not doing at all)....it's driving me mad !!

Thanks in advance
 
Your connection string is wrong you need to specify server:=****

you can also do another syntax where you specify a driver as well - search on vb developers rather than access and look around ado connection objects or odbcconstr

 
timbo,
Did you, by any chance, copy/paste the dbDriverComplete or any other constants, from the Help file? If you do this, the help file's contain hidden characters which make the actual value of the constants different. If you completely clear that out and type the constants in, then you're usually ok.
It's just a thought, the other values look ok.
--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top