Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    linking with password (Access 2000)

    Can somebody show me how can i rewrite my function for linking tables so that it links to a database,having a password "secret"?


    Public Function LinkAllTables(DBName)
    'link all user tables in source database
    Dim FrontDB As DAO.Database, BackDB As DAO.Database
    Dim Tbl As DAO.TableDef, Lnk As DAO.TableDef
    Set FrontDB = CurrentDb
    Set BackDB = OpenDatabase(DBName)

    For Each Tbl In BackDB.TableDefs
    If Tbl.Attributes = 0 Then
    Set Lnk = FrontDB.CreateTableDef( _
    Name:=Tbl.Name)
    Lnk.SourceTableName = Tbl.Name
    Lnk.Connect = ";DATABASE=" & BackDB.Name
    FrontDB.TableDefs.Append Lnk
    End If
    Next
    DoCmd.Beep
    End Function



    i tried to write
    Set BackDB = OpenDatabase(DBName,Secret), but i have been shown an error "data type conversion error"

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: linking with password (Access 2000)

    Change the line :
    Set BackDB = OpenDatabase(DBName)
    to
    Set BackDB = OpenDatabase(DBName, False, False, "MS Access;PWD=secret")
    Francois

Posting Permissions

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