Microsoft Knowledge Base Email Alertz

KBAlertz.com: (109829) - Advanced: Requires expert coding, interoperability, and multiuser skills. When you first link (attach) an external table using an ODBC driver, you have the option to store the User ID and password for the table locally. If you do not store the ID...

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]





ASP.NET 2.0 Web Hosting with SQL 2005: Click Here!
Discount ASP.NET Hosting


Bug Tracking Software
For bug tracking software or defect tracking software or issue tracking software, visit Axosoft.


Community Site



We Send hundreds of thousands of emails using ASP.NET Email



Expert Web Design & Graphic Design
Design44.com




Mentioned In








Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks




ACC: Sample Function to Provide Password for Attached Tables

Retired KB ArticleThis article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
Article ID:109829
Last Review:January 18, 2007
Revision:2.2
This article was previously published under Q109829

SUMMARY

Advanced: Requires expert coding, interoperability, and multiuser skills.

When you first link (attach) an external table using an ODBC driver, you have the option to store the User ID and password for the table locally. If you do not store the ID and password locally, you will be prompted later for the ID and password when you open the table (either manually or programmatically).

This article describes a sample function that you can use in Microsoft Access 97, 7.0, 2.0 and 1.x to eliminate the login prompt when you open the table.

This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to your version of the "Building Applications with Microsoft Access" manual.

NOTE: Visual Basic for Applications is called Access Basic in Microsoft Access versions 1.x and 2.0. For more information about Access Basic, please refer to the "Introduction to Programming" manual in Microsoft Access version 1.x or the "Building Applications" manual in Microsoft Access version 2.0.

MORE INFORMATION

The following steps demonstrate how to eliminate the login prompt when you open a linked table:
1.You must first provide your login information. To do this, use one of the four standard ODBC dialog boxes, or create your own custom login box.
2.Use the sample function below (or one similar to it) along with a valid <UserId> and <Password> to establish the connection.

NOTE: In the following sample code, an underscore (_) is used as a line- continuation character. Remove the underscore from the end of the line when re-creating this code in Access Basic.
      Function Establish_Connection ()
         Dim db As Database, dbcurr As Database
         Dim ds As Recordset 
         Set dbcurr = CurrentDB()
         Set db = OpenDatabase("", False, False, _
            "ODBC;DSN=<data source name>;" & _             
            "UID=<UserID>;PWD=<Password>;DATABASE=" & _    
            "<database name>;")
         Set ds = db.OpenRecordset("<any table existing in the 
          database defined by DATABASE above>")
      End Function
						

Substitute your own server name, password, database name, and table name in the function above.
When you run this function, Microsoft Access establishes a connection with the server specified in the function. The Connection Manager then stores the connection information, enabling you to open other linked tables on that server without being prompted for the login information each time. The Connection Manager will retain the login information until you quit Microsoft Access.

APPLIES TO
•Microsoft Access 2.0 Standard Edition
•Microsoft Access 95 Standard Edition
•Microsoft Access 97 Standard Edition

Back to the top

Keywords: 
kbinfo kbprogramming kbusage KB109829
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Be the first to leave feedback, to help others about this knowledge base article.

(Optional) Name

(Optional) Public URL Or Email

Comments
No HTML -- Text Only Please