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

Access does not hold ODBC conection details

Status
Not open for further replies.

TTEL

IS-IT--Management
Jun 20, 2004
68
0
0
GB
I have an Access 97 database that connects to Oracle through ODBC using the following procedure:

Function EstablishConnection()

On Error GoTo EstablishConnection_Err

Dim db As Database
Dim dbCurrent As Database

Set dbCurrent = CurrentDb()
Set db = OpenDatabase("", False, False, "ODBC;DSN=LIVE;SERVER=tropos;UID=ROLIVEDB;PWD=ROLIVEDB")
Exit Function

EstablishConnection_Err:
'If Err.Number <> 0 Then
MsgBox "Unable To Connect To Tropos Database - Please Try Later" & vbCrLf & "The Database Will Now Be Closed", vbCritical
DoCmd.Quit acSave
'End If

End Function


However recently the database always requires users to enter the Oracle ODBC passwords, previously it did not.
We have recently upgraded from Windows NT to Windows 2000 and this is when the problems started.
How can I get the ODBC connection details to be remembered so that the user doesn't have to keep retyping it?

Thanks.
 
I had the same problem when i switch to 2000 - I made the following function:
-----------start function---------
Function LogonToOracle() As Boolean
' Comments :
' Parameters : -
' Returns : Integer -
' Created : 2/1/99
' Modified :
'
' --------------------------------------------------------

On Error GoTo LogonToOracle_Err


Dim strSzConnect As String
Dim strRoleString As String

strRoleString = "Set role vniscud identified by cudsinv"
globals.gintLocal = False
If globals.gintProd Then
Set DBGlobals.wrkSpace = DBEngine.Workspaces(0)
strSzConnect = "ODBC;DSN=PRDVNS;UID=PRDVNS;PWD=oracle; " & strRoleString
globals.gstrTblPrefix = "PRDVNS_"
Set DBGlobals.gdbsDb = DBGlobals.wrkSpace.OpenDatabase("", False, False, strSzConnect)
Else
globals.gintLocal = True
globals.gstrTblPrefix = ""
End If
Set DBGlobals.gdbsDb = CurrentDb()
LogonToOracle = True


LogonToOracle_Exit:
Exit Function

LogonToOracle_Err:

MsgBox Err.Number & Err.DESCRIPTION
LogonToOracle = False
Resume LogonToOracle_Exit
End Function
-----------end-------------------------
this goes in the declarations
Private Type GlobalDataBase
wrkSpace As Workspace
gdbsDb As Database
End Type

Public DBGlobals As GlobalDataBase
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top