Oracle ODBC Connection Error 3151 (1 Viewer)

Insane_ai

Not Really an A.I.
Local time
Yesterday, 21:45
Joined
Mar 20, 2009
Messages
264
The following code works when employed on Windows XP clients. I am upgrading to Windows 7 Professional 64 bit. I have verified the ODBC connection is working properly through the ODBC management.

I get Error 3151

Private Sub Form_Load()
Dim DB As DAO.Database
Dim TDF As DAO.TableDef

'Refresh Databse Link
Set DB = CurrentDb()
Set TDF = DB.TableDefs("EWVPD_PRODUCT")
TDF.Connect = "ODBC;DSN=[DSN_NAME];UID=[USER];PWD=[Password]"
TDF.RefreshLink



DoCmd.OpenForm "Main", acNormal


DoCmd.Close acForm, Me.Name

End Sub


Error Message:

Run-time error '3151'
ODBC connection to '[DSN_NAME] failed

The code in RED is being flagged for the error.


The file's location is in the trusted locations via registry edits.

The idea of this code is to make a connection to the Oracle database in the background when the application opens to avoid password issues.

Any advice on the configuration or re-coding of this is greatly appreciated. I suspect I will have to add code to compare the host operating system so I use the proper method depending on the client using the application.
 
Last edited:

mdlueck

Sr. Application Developer
Local time
Yesterday, 21:45
Joined
Jun 23, 2011
Messages
2,631
The following code works when employed on Windows XP clients. I am upgrading to Windows 7 Professional 64 bit

You should specify what version of Access you had the application working properly with on Windows XP, and what version (including compiled architecture) you are attempting to use on Windows 7.
 

Insane_ai

Not Really an A.I.
Local time
Yesterday, 21:45
Joined
Mar 20, 2009
Messages
264
SOLUTION:

I was using the ODBC connection manager through Administrative Tools which by default creates 64-bit ODBC connections. This cannot work on a 32 bit application.

I uninstalled the 64 bit Oracle Client and installed the 32 bit Client.

Then per http://support.microsoft.com/kb/942976 I manually invoked the 32-bit ODBC Connection manager (%windir%\SysWOW64\odbcad32.exe) and created the ODBC connection there. All works as expected.
 

Insane_ai

Not Really an A.I.
Local time
Yesterday, 21:45
Joined
Mar 20, 2009
Messages
264
@mdlueck:

Thank you very much for your response.

I am using 32-bit Access 2007 to develop on another machine and using Access 2007 32 bit Runtime for the clients.

I am not using Windows XP mode to run this application because I am using that to run Access 2000 legacy apps required for historical reference.
 

mdlueck

Sr. Application Developer
Local time
Yesterday, 21:45
Joined
Jun 23, 2011
Messages
2,631
Then yes, with 32-bit Access, quite likely the ODBC driver would be the cause of the trouble.

FYI: For connecting to SQL Server on x64 Windows (XP and 7) from 32-bit Access, the default supplied SQL Server ODBC driver works flawlessly. I have never worked with the SQL Server Native driver, however.

Oh oh, and I see your note about evoking the 32-bit ODBC control panel applet... My application uses a DSN'less connection.
 

Users who are viewing this thread

Top Bottom