Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleUse the Data control with a password protected Access 2000 database
KeywordsData control, Access, password, DAO
CategoriesControls, Database
 
Use the Project menu's References command to set a reference to the Microsoft DAO 3.6 Object Library.

Create Database and Recordset objects. Open the database using DBEngine.OpenDatabase. Use the database's OpenRecordset method to create the Recordset. Then attach the Recordset to the Data control's Recordset property.

 
Private Sub Form_Load()
Dim file_name As String
Dim db As Database
Dim rs As Recordset

    ' Open the database.
    file_name = App.Path
    If Right$(file_name, 1) <> "\" Then file_name = _
        file_name & "\"
    file_name = file_name & "People.mdb"
    Set db = DBEngine.OpenDatabase(file_name, False, False, _
        "MS Access;PWD=people")

    ' Create the Recordset.
    Set rs = db.OpenRecordset("People")

    ' Attach the Recordset to the Data control.
    Set Data1.Recordset = rs
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated