Results 1 to 2 of 2
  1. #1
    shod90 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2016
    Posts
    134

    Relink tables with password


    Dear Gents,
    I have a software i already separated the backend to be more reliable for our work.
    I added a password for it to be more secure .
    I found that code on internet that check if the tables are linked or not and if not , it ask for new location by opening wizard to select the new location .. But it's not working with password .. Can vba experts edit that code to be working on encrypted backend.

    Here's the code.
    Code:
    On Error Resume Next
    Dim fDialog As Office.FileDialog
    Dim td As TableDef
    Dim db As DAO.Database
    Dim strOld As String
    Dim strNew As String
    Set db = CurrentDb
    strOld = Mid(db.TableDefs("TableName").Connect, 11)
    If Dir(strOld) = "" Then
        MsgBox "Can't Find Database source , Please select another Database", vbInformation
       Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
       With fDialog
          .AllowMultiSelect = False
          .Title = "Please choose Database location"
          .InitialFileName = "C:\" 'use appropriate drive letter
          .Filters.Clear
          .Filters.Add "Access file", "*.accdb"
          If .Show = True Then
             strNew = .SelectedItems(1)
             For Each td In db.TableDefs
                If InStr(td.Connect, strOld) > 0 Then
                    Debug.Print td.Name
                    Debug.Print "Old Link: " & td.Connect
                    td.Connect = Replace(td.Connect, strOld, strNew)
                    td.RefreshLink
                End If
             Next td
          Else
             MsgBox "Canceled", vbInformation
          End If
       End With
    End If
    Last edited by shod90; 08-16-2020 at 12:11 AM.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,527
    if you link the tables with the password manually, then deliver the Front end, the user never has to relink it themselves.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Automatically relink backend tables
    By SierraJuliet in forum Access
    Replies: 7
    Last Post: 01-16-2019, 10:54 AM
  2. Relink access tables from excel macro
    By Ndain in forum Access
    Replies: 2
    Last Post: 02-22-2017, 07:04 PM
  3. Linking Tables to Sql Password question
    By crimedog in forum Import/Export Data
    Replies: 2
    Last Post: 01-21-2016, 09:03 AM
  4. Replies: 2
    Last Post: 11-05-2013, 03:59 AM
  5. Relink split database where no UI
    By Owl in forum Access
    Replies: 3
    Last Post: 07-13-2010, 11:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums