Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Connect to Oracle from access (Programmatically)

625428Feb 26 2008
Hi,

I just found a sample code how to connect to Oracle from access, but it always give me an error msg said connection failed.

This is my code looks like. It always go to the connection failed. Can anyone help me pls?

appreciate it any help thx.

Function OracleConnect() As Boolean

Dim ws As Workspace
Dim db As Database
Dim LConnect As String

On Error GoTo Err_Execute

'Use {Microsoft ODBC for Oracle} ODBC connection
LConnect = "ODBC;DSN=hrdevl;UID=ma_user;PWD=password;SERVER=perdv02"

'Point to the current workspace
Set ws = DBEngine.Workspaces(0)

'Connect to Oracle
Set db = ws.OpenDatabase("", False, True, LConnect)

db.Close

OracleConnect = True

Exit Function

Err_Execute:
MsgBox "Connecting to Oracle failed."
OracleConnect = False

End Function
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 25 2008
Added on Feb 26 2008
0 comments
1,698 views