Save Password with Linked Tables

R

RMCompute

Listed below is a shorted version of the code I have created. In the actual
code, a table is read which contains several table names and is processed in
a loop. When each record is read, the code below is populated with a FROM
TABLE AND a TO TABLE NAME and the next sequential record of the array is
read. For this test code intCnt is set to 1. The problem is, although the
password is placed into the code and the table is successfully created, when
the user enters the application and clicks the table, an error is displayed
that the connection cannot be made and requests a password. When the table
is created manually, I check the Save Password box. In this case, when the
user enters the application and clicks the table, they connect successfully
and do not have to enter a password. Is there a switch which can be set
programatically which would set the Save Password box?

Dim tbl As TableDef, conStr As String, tblNm
ReDim AttachedTD(200) As New TableDef

conStr = "ODBC;DRIVER={sql server};" & _
"SERVER=rusxxlqa.us.ricxx.ds,10012;" & _
"DATABASE=SAM;" & _
"UID=Test;" & _
"PWD=Test;" & _
"APP=Microsoft Office 2003;" & _
"WSID=A64X2"

intCnt = 1
AttachedTD(intCnt).Connect = conStr
AttachedTD(intCnt).SourceTableName = “TestFromTableâ€
AttachedTD(intCnt).NAME = “TestToTableâ€
db.TableDefs.Append AttachedTD(intCnt)
db.TableDefs.Refresh
 
A

Alex Dybenko

Hi,
Try to use CreateTableDef, where you can specify dbAttachSavePWD attribute:

intCnt = 1
AttachedTD(intCnt) = db.CreateTableDef("TestToTable", dbAttachSavePWD,
"TestFromTable", conStr )
db.TableDefs.Append AttachedTD(intCnt)
db.TableDefs.Refresh

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
 
R

RMCompute

It worked! Thank you!

Alex Dybenko said:
Hi,
Try to use CreateTableDef, where you can specify dbAttachSavePWD attribute:

intCnt = 1
AttachedTD(intCnt) = db.CreateTableDef("TestToTable", dbAttachSavePWD,
"TestFromTable", conStr )
db.TableDefs.Append AttachedTD(intCnt)
db.TableDefs.Refresh

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
 

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