Solved

tabledef.connect changed when appended to Tabledefs collection!

Posted on 2004-04-20
2
1,564 Views
Last Modified: 2007-12-19
I am building a solution using Access 2000 to connect to SQL Server 2000 database.  I am using DSN-less connections, using code to link the appropriate tables. I'm using DAO 3.6.

My problem is that although I explicitly set the Connect property of my new, un-appended tabledef, when the tabledef is appended, the connect changes.  Specifically, I set the Connect as follows:

dim db as DAO.database
dim tdf as DAO.tabledef

set db = currentdb()
set tdf = db.CreateTableDef(strTable) ' strTable passed to procedure

tdf.Connect = "ODBC;DRIVER=SQL Server" _
                & ";Server=(local);DATABASE=myDb"  _
                & ";UID=Tester;Pwd=test" _
                & ";Trusted_Connection=NO"

tdf.SourceTableName = strBaseTable ' passed to procedure

Debug.Print tdf.Connect  ' See output A
db.tabledefs.append tdf
Debug.Print tdf.Connect  ' See output B


Output A:
ODBC;DRIVER=SQL Server;Server=(local);DATABASE=myDb;UID=Tester;Pwd=test;Trusted_Connection=NO

Output B:
ODBC;DRIVER=SQL Server;SERVER=(local);UID=myWindows;PWD=;APP=Microsoft Access;WSID=myMachine;DATABASE=myDb;Trusted_Connection=Yes

where myWindows is my windows logon (no domain, i'm doing this locally using machine accounts).  As you can see, the connect string changed, in some very significant ways.  The user name and password are changed and it is now a Trusted connection.  SQL Server is using mixed authentication.

Anyone know what is causing this?  Anything I can do about it?  Obviously, this will greatly affect my security scheme, since I now can't log on specific users!

Thanks!





0
Comment
Question by:teiwaz
2 Comments
 
LVL 5

Accepted Solution

by:
a1x earned 500 total points
ID: 10874886
On my machine, the change to userid/password/trusted connection didn't happen.  APP and WSID were added per your example.  

The problem may be related to http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q279/5/26.ASP&NoWebContent=1, so check your OCBC driver version.
0
 
LVL 1

Author Comment

by:teiwaz
ID: 10878727
Yep, that was it.  I had the MDAC version with this problem.  Thanks!

BTW, look for the follow-up question on how to determine the MDAC version on the user's computer, so I can make sure they don't have this problem :D
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question