Results 1 to 3 of 3

Thread: Open a PWD Protected Access MDB

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Posts
    3

    Post

    Any body got any ideas on how to do this once. I can already do it with a data control and use the following code, however it get a bit tedious when you have to do it all againg for another form etc

    With Data1
    .DatabaseName=App.Path & "\my.mdb"
    .RecordSource="mytable"
    .Connect=";Pwd=password"
    .Refresh
    End With

    some form of function could be the answer but so far I have failed in getting one to work.

    charlie

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    Put this code into a module:
    Code:
    Public Sub PopulateDataControlProperties(dataControl As Control, Recordsource As String)
        
        With dataControl
            .DatabaseName = "nwind.mdb"
            .Recordsource = Recordsource
            .Connect = ";Pwd=password"
            .Refresh
        End With
            
    End Sub
    and put this into the Form_Load event of the form with the data control:

    Code:
    Private Sub Form_Load()
           
     
        PopulateDataControlProperties Data1, "Customers"
        
    
    End Sub
    There are few different ways you can do it, but this will automatically populate the data control that you specify with the correct parameters and you can choose your recordset too....

    HTH

    Tom

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Posts
    3

    Post

    Tom

    Thanks for that I waS looking at it from a differenty angle. surprising what a fresh pair of eyse can do

    Charlie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width