Results 1 to 2 of 2
  1. #1
    DaveFromNH is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2011
    Posts
    2

    Need to securely link to SQLServer DB From MSAccess - and build Package Solution

    I have an SQLServer database on a remote server which is used by our web site.

    I have a set of reports which I built using MSAccess 2010 and I use ODBC to link to that SQLServer database.

    I want to build a "Package Solution" to distribute the MSAccess database, but I don't want to give the database password to everyone who will install the solution.

    I've assumed that I should have my MSAccess startup page have no recordsource, but in the "on open" event I should programmatically re-link the tables providing the password in code (which I'll secure). After successfully relinking the tables, I'll then open the 'real' main menu and close this 'initiator' form.
    I'm having a problem relinking the tables. The tdf.RefreshLink always throws error 3151 ; "ODBC--connection to 'Cert123.dsn' failed."
    Here is my code;
    Dim dbs As Database
    Dim tdf As TableDef
    Dim Tdfs As TableDefs
    Dim strConnect As String
    Set dbs = CurrentDb
    Set Tdfs = dbs.TableDefs
    For Each tdf In Tdfs
    If tdf.SourceTableName <> "" Then
    strConnect = "ODBC;" & _
    "Server=123.123.123.123,25000;" & _
    "Database=DB123_Cert;" & _ "Uid=User123;" & _
    "Password=mypwd123;" & _


    "DSN=Cert123.dsn;" & _
    "ProviderName=System.Data.SqlClient"
    tdf.Connect = strConnect
    tdf.RefreshLink
    End If
    Next
    Any assist is appreciated (including if there is a better way to hide the database password in the published solution).
    Dave

  2. #2
    DaveFromNH is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2011
    Posts
    2
    I've been able to get around this problem with a bit of a radical approach... I found a Microsoft KB article about "How to create a DSN-less connection to SQL Server for linked tables in Access"; http://support.microsoft.com/kb/892490

    Using their sample function code as a guide, I've been able to hide the DB password in code and dynamically link to the DB at run time.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Learn MSAccess by playing MSAccess Jeopardy
    By pkstormy in forum Sample Databases
    Replies: 4
    Last Post: 11-17-2016, 07:27 AM
  2. DLookup or Other Solution
    By IFA Stamford in forum Access
    Replies: 3
    Last Post: 12-31-2010, 11:18 AM
  3. package access dtabase in .msi
    By ManvinderKaur in forum Access
    Replies: 1
    Last Post: 08-12-2010, 09:53 PM
  4. Corrupt Database: Possible solution?
    By asearle in forum Access
    Replies: 2
    Last Post: 07-14-2010, 01:59 PM
  5. Best solution
    By geeka in forum Access
    Replies: 1
    Last Post: 12-04-2006, 01:12 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums