Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Multiuser / Networking / June 2007

Tip: Looking for answers? Try searching our database.

Linking to a password protected BE

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
wphx - 28 Jun 2007 02:02 GMT
Hi,

I'd like to be able to programatically set up a link to a .mdb file with a
password on it (password set using tools/security/set password).  Is this
possible, if so how?

Thanks if you can help
tina - 28 Jun 2007 03:05 GMT
the way i did it was to manually link the table once, and save a link
Specification. then i added the following code to a standard module in my
database, as

Public Function isConnect(ByVal strDBType As String, strLinkedTable As
String, _
   strFilePath As String, strSourceTable As String, strPW As String) As
Long

   On Error GoTo Err_Connect
   DoCmd.TransferText

   Dim tdfLinked As TableDef

   isConnect = -1

   Set tdfLinked = CurrentDb.CreateTableDef(strLinkedTable)
   tdfLinked.Connect = strDBType & ";DATABASE=" & strFilePath & ";PWD=" &
strPW
   tdfLinked.SourceTableName = strSourceTable
   CurrentDb.TableDefs.Append tdfLinked

End_Connect:
   Exit Function

Err_Connect:
   Select Case err.Number
       Case 2495  ' the TransferText error that "initializes"
                           ' the saved link specification.
           Resume Next
       Case 3024  ' file doesn't exist
           isConnect = err.Number
           Resume End_Connect
       Case 3012  ' table is already connected
           Resume Next
       Case 3043  ' disk or network error
           isConnect = err.Number
           Resume End_Connect
       Case Else
           MsgBox err.Number & "  -  " & err.Description
           Resume End_Connect
   End Select

End Function

then i called the code from a form in my database, as

       lng = isConnect("", "LinkedTableName", _
           "\\RootFolder\Subfolder\MyBEdb.mdb", _
           "SourceTableName", "mypassword")
       If lng > 0 Then
           MsgBox "Connection error " & lng & ". Contact the programmer,
please."
       End If

hopefully this gives you a starting point, anyway.

hth

> Hi,
>
[quoted text clipped - 3 lines]
>
> Thanks if you can help
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.