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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS access database calling SQL database with login 2

Status
Not open for further replies.

tbark

MIS
Nov 5, 2002
3
0
0
US
I have an Access database with linked tables to an Altiris SQL database. I have built a query in Access to find Inventories older than 90 days. The query works in Access. (I have to enter a password for the ODBC connection to Altiris) I am creating a web page to display these Inventories, but I get an ODBC connection failed in Dreamwearver. I have a connection to the AltirisDB as well. I want to embed the username and password in some way for my Access database to pass to the Altiris for this query. Is this the way to do it or am I missing somethig?
 
When you initially link to the SQL table from Access, you should have a Save Password checkbox that is available to you when you enter your username/password. However, it is stored visibly to anyone who can get access to the MsysObjects table.
 
There is not an option to Save Password.

 
linksql01.png
 
Why not just get the data directly to your web app from the SQL server?

 
Thanks Bob for your post. I never noticed that box before. That did it!!!
 
Is there anyway to get the database to remember the password without setting up the links again?

Sorry for the necro post, but this is exactly what I was looking for.

**********************************************************
If I had my own icecream van the chimes would play "Don't fear the reaper"
**********************************************************
 
Actually, you can with code:
Code:
Public Sub ChangeSQLConnection(NewConnection As String)
    Dim dbs As DAO.Database
    Dim tdf As TableDef
    
    Set dbs = CurrentDb
    
    For Each tdf In dbs.TableDefs
        'Only change tables linked to SQL server
        If Left(tdf.SourceTableName, 4) = "dbo." And Left(tdf.Name, 4) <> "MSys" And _
         tdf.Connect <> "" Then
            tdf.Connect = NewConnection
            tdf.RefreshLink
        End If
    Next
    
    Set tdf = Nothing
    Set dbs = Nothing
    
    MsgBox "Finished Relinking!", vbInformation, "Finished"
End Sub

The connection string you pass could be something like:

ODBC;Driver={SQL Native Client};Server=MyServer;Database=MyDatabase;Uid=MyLogin;Pwd=MyPassword;

Joe Schwarz
Custom Software Developer
 
Ahh right

With the number of different data sources we've got that wouldn't be very practical, but thanks for the tip!

**********************************************************
If I had my own icecream van the chimes would play "Don't fear the reaper"
**********************************************************
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top