Requiring Password Validation : Database Password « Access « VBA / Excel / Access / Word






Requiring Password Validation

 
Sub ReallySecure()
    Dim cat As ADOX.Catalog
    Dim tbl As ADOX.Table
    Dim strPassword As String

    Set cat = New ADOX.Catalog

    cat.ActiveConnection = CurrentProject.Connection

    Set tbl = New ADOX.Table
    tbl.Name = "tblLinkedTable"
    Set tbl.ParentCatalog = cat

    strPassword = "pass"

    tbl.Properties("Jet OLEDB:Create Link") = True
    tbl.Properties("Jet OLEDB:Link Provider String") = "ODBC" & _
        ";DATABASE=Pubs" & _
        ";UID=SA" & _
        ";PWD=" & strPassword & _
        ";DSN=YourData"
    tbl.Properties("Jet OLEDB:Remote Table Name") = "Employees"
    cat.Tables.Append tbl
End Sub

 








Related examples in the same category

1.Setting a Database Password
2.Setting a Database Password with SQL command
3.Deleting a Database Password with SQL command
4.Changing a User Password
5.Embedding a Database Password in Code