Results 1 to 8 of 8
  1. #1
    SierraJuliet's Avatar
    SierraJuliet is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Dec 2017
    Location
    Earth
    Posts
    211

    Automatically relink backend tables

    Anyone have a good method for relinking backend tables without organic MS Access 2013 ODBC utility? The reason I ask is because the frontend will be locked down and the EXTERNAL DATA > ODBC Database option will be unavailable.



    The goal is to have a frontend and backend. The frontend is MS Access that opens a splash screen (check backend table links) and login window (accesses credential table). The backend tables are stored in MySQL.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    SierraJuliet's Avatar
    SierraJuliet is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Dec 2017
    Location
    Earth
    Posts
    211
    Thanks June7 but I prefer a working solution.

    Someone has to have working VBA code for executing some sort of ODBC type connection from MS Access to relink tables in MySQL backend when the frontend is locked down. Based on what I have discovered, MS Access frontend and MySQL backend is a common trend and thus someone has came up with a solution to this problem. This is obviously not a concern when the frontend is not locked down; however, I doubt most frontend instances are not locked down if for nothing more than for end-product cleanliness.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    Some of the posts in that thread indicate a solution for relinking. None apply to your situation?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Minty is offline VIP
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,144
    In addition to the link June provided, this is the defacto description of methods of using DSN Less connections.

    http://www.accessmvp.com/DJSteele/DSNLessLinks.html

    it's written for SQL Server but simply needs the connection strings adjusting accordingly.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  6. #6
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,127
    Have a look at the outline of my approach which I've just written at another forum: https://www.access-programmers.co.uk...90&postcount=2

    If you decide to use DSN less connections (which I recommend), also look at https://www.connectionstrings.com/
    That site covers every possible connection you are ever likely to need (and lots you won't ...)
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  7. #7
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,235
    Here is what I use to switch a front-end between two servers (development and production). I have a local settings table with a boolean field (VerifyLinks) to flag that the front-end needs to be re-linked. I call the vcVerifyMySQLLinks function on the very first line of my AutoExec macro (using RunCode). So when I need to force all front-ends to relink (i.e. for update purposes) I would check the VerifyLinks field, set the connection string in my ConnectionString field (these are both in a local hidden SettingsTable).

    Code:
    Public Function vcVerifyMySQLLinks()
    Dim boVerify As Boolean
    On Error Resume Next
    boVerify = DLookup("[VerifyLinks]", "[SettingsTable]")
    'refresh links and reset flag
    If boVerify = True Then
        vcLinkTableDefs
        DoCmd.SetWarnings False
        DoCmd.RunSQL "UPDATE [SettingsTable] SET [SettingsTable].[VerifyLinks] = False"
        DoCmd.SetWarnings True
    End If
    End Function
    
    
    
    
    Public Sub vcLinkTableDefs()
    
    
    Dim dbs As DAO.Database
    Dim tdf As DAO.TableDef
    Dim strNewConnectionString As String
    
    
    On Error Resume Next
    
    
    
    
      Set dbs = CurrentDb()
    
    
      ' Loop through TableDefs collection, only processing
      ' the table if it already has a Connection property.
      ' (all other tables are local ... not linked)
    
    
      For Each tdf In dbs.TableDefs
    
    
        If tdf.Connect <> "" Then
        strNewConnectionString = DLookup("[ConnectionString]", "[SettingsTable]")
            If tdf.Connect <> strNewConnectionString Then
                tdf.Connect = strNewConnectionString
                tdf.RefreshLink
            End If
        End If
      Next
     
    
    
    End Sub
    Please note that you cannot have a default bound form set as the opening form if using this approach. I open my "switchboard" in the same autoexec macro on the line following the one the checking for/re-linking.

    For MySQL I use the following connection string (stored in the ConnectionString field using a password Input Mask):
    ODBC;DRIVER={MySQL ODBC 5.1 Driver};SERVER=YourServer;DATABASE=YourDatabaseNam e;PORT=3306;UID=YourUser;PWD=YourPassword;Option=4 194314

    Cheers,
    Vlad

  8. #8
    SierraJuliet's Avatar
    SierraJuliet is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Dec 2017
    Location
    Earth
    Posts
    211
    Quote Originally Posted by June7 View Post
    Some of the posts in that thread indicate a solution for relinking. None apply to your situation?
    I read through it and the solution from 2005 requires tweaking and troubleshooting to get working. I have been away from working my database for a while and the less reworking the better at the moment. I think someone has a solution for the very instance I am discussing.

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

Similar Threads

  1. Relink access tables from excel macro
    By Ndain in forum Access
    Replies: 2
    Last Post: 02-22-2017, 07:04 PM
  2. Split Database Backend table delete records automatically
    By ChobeyGuddu in forum Database Design
    Replies: 5
    Last Post: 01-30-2017, 02:26 PM
  3. Access tables in backend from VBA
    By uaguy3005 in forum Programming
    Replies: 2
    Last Post: 01-16-2014, 04:07 PM
  4. Replies: 2
    Last Post: 11-05-2013, 03:59 AM
  5. lookup values in backend tables
    By deb56 in forum Database Design
    Replies: 1
    Last Post: 01-23-2008, 11:12 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