Suppressing User ID/Password prompt on connection

MrFuels

New member
Local time
Today, 00:29
Joined
Jun 16, 2011
Messages
1
Hello,

I have an Access application which used to connect automatically to MAS90 tables (SOTAMAS90 ODBC) in Access 2003 & Access 2007. The module below would run in the Form_Load event.

However, when we upgraded to Access 2010, the connect line below stopped working & displays an Runtime Error 3151. It is only when I took out the User ID & Password in the connect line that the application worked. However, the application now prompts for User ID/Password before the application's main form opens.:mad:

Has the connect syntax changed to Access 2010 ? How do I continue to suppress the login prompt in Access 2010 ? Trying to get this fixed ASAP - Thanks !

========================================================
Sub ChangeConnectionString()
Dim Dbs As Database
Dim Tdf As TableDef
Dim Tdfs As TableDefs
Set Dbs = CurrentDb
Set Tdfs = Dbs.TableDefs

'Loops through list of tables
For Each Tdf In Tdfs
'Criteria for selecting which table
'to change the connection string of
If Tdf.SourceTableName <> "" And InStr(Tdf.SourceTableName, "dbo") = 0 Then
Worked for Access 2003 & 2007 >>> Tdf.Connect = "ODBC;DSN=SOTAMAS90_LIVE;UID=RPT|CFS;PWD=GASOLINE;COMPANY=CFS"
Tdf.Connect = "ODBC;DSN=SOTAMAS90;COMPANY=CFS"
Only works for Access 2010 >>>> Tdf.Connect = "ODBC;DSN=SOTAMAS90;COMPANY=CFS"
Else
Exit Sub
End If
Next
End Sub
 

Users who are viewing this thread

Back
Top Bottom