Connection to Linked ODBC Tables

Y

y770

I have a Access database with Linked ODBC Tables.
Every first time I open the form that uses these tables the ODBC connection
Dialog pops up asking for a password. I can manually enter the password and
get thru. I would prefer to hardcode the user name and pasword into the
database so the user will not have to re enter them every time.

I've tried the following:
CurrentDb.Connect = "ODBC;DATABASE='...'; DSN='...'; UID='...';
PWD='...';"
CurrentDb.TableDefs(i).Properties("Connect") "ODBC;DATABASE='...';
DSN='...'; UID='...'; PWD='...';"
CurrentDb.TableDefs(i).Properties.Refresh
CurrentDb.TableDefs(i).RefreshLink

Execution of last line still cause the connection failure. BTW, Error
message show the wrong User Name.

Any suggestions?
 
R

Ralph

For Oracle I have used:

Dim db as database
db=OpenDatabase(Database, False, False, "ODBC;DSN= "";UID= "";PWD=""
;DATABASE="")
 
Y

y770

I am using SQL Server, your suggestion did not work, so I have to modify it
in the following manner:

Dim wrkSp As Workspace
Dim db As Database

Set wrkSp = CreateWorkspace("", "admin", "", dbUseJet)
Set db = wrkSp.OpenDatabase("...", False, False, "ODBC; DATABASE='...';
DSN='...'; UID='...';PWD='...';")

Still Access does not like it with a message "ODBC Connection failed".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top