Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking to SQL

Status
Not open for further replies.

Manch

Programmer
Jun 12, 2001
43
US
I am linking Access tables to SQL server using the following code:
Code:
mblnErrorOccurred = False
    If Right$(strDSN, 4) = "Test" Then
        strDatabase = "VBackendTest"
    Else
        strDatabase = "VBackend"
    End If
    
    intNumTables = VOREGdb.TableDefs.Count
    varReturn = SysCmd(acSysCmdInitMeter, "Relinking Tables", intNumTables)
    intI = 0
    For Each tdf In VOREGdb.TableDefs
        If Len(tdf.Connect) > 0 Then
            strNewConnectString = "ODBC;DSN="
            strNewConnectString = strNewConnectString & strDSN
            strNewConnectString = strNewConnectString & ";UID=" & strUID & ";APP=Microsoft® Access;DATABASE=" & strDatabase & ";Network=DBMSSOCN;Password=test;Trusted_Connection=NO"
            tdf.Connect = strNewConnectString
             
            On Error Resume Next
            tdf.RefreshLink
            If Err.Number <> 0 Then
                mblnErrorOccurred = True
                mstrErrorMessage = Err.Description
                varReturn = SysCmd(acSysCmdRemoveMeter)
                GoTo Exit_Proc
            End If
        End If
        intI = intI + 1
        varReturn = SysCmd(acSysCmdUpdateMeter, intI)
[\code]

This links the tables fine, but the first table causes the SQL Server DSN dialog box to display.  The dialog box has the DSN name I provided in the connect string already filled in, but the password must be provided again even though I have provided that in the connect string as well.
Is there any way to stop the dialog box from dispaying?

Any help would be greatly appreciated.
Phil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top