Database Administration (MOSC)

MOSC Banner

How to programically create Oracle DSN in MSAccess Application

edited May 2, 2018 5:00AM in Database Administration (MOSC) 1 commentAnswered

Hi All,

I have a couple MS Access 2013 applications.  When the user opens the application, I need to check for and if needed create the DSN to link from MSAccess to Oracle 11g.

Has anyone done this before?

TIA,

Kathy

Sub CreateUserDSN()

    Dim stAttributes As String

    ' Build the attributes string

    stAttributes = "Database=CREATE_DSN_TEST" & vbCrLf & _

    "Description=CREATE DSN TEST" & vbCrLf & _

    "OemToAnsi=No" & vbCrLf & _

    "Server=OURSERVERNAME" amp; vbCrLf amp; _

    "Trusted_Connection=Yes"

   

    ' Create the DSN

    DBEngine.RegisterDatabase "Oracle", "Oracle in OraClient 11g_home1", True, stAttributes

End Sub

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center