Reputation: 28016
I have an Access database which is split, and have moved it from the network and a client machine to my machine to test and debug.
When I run the main/startup form, I get:
Run-time error 3044. [Old Path] is not a valid path.
Where "Old Path" is the path where the back-end file used to reside.
I found some posts that talked about using the Linked Table Manager, but this is greyed out in my backend database and does not exist as an option in my front end database.
I can't find anywhere in the Module or form code where this gets set. Can anyone shed any light on where this information is stored?
Upvotes: 3
Views: 13350
Reputation: 2050
Sounds like the OP can resolve their issue using everyone else's answers to relink the table; however people landing here looking for an alternate answer to "MS-Access ... 3044 error" may like to know that the 3044 error can also be caused by the linked back-end MS-Access database not being either a trusted document or in a trusted location. Which can be resolved via: opening the back-end db and adding it as a trusted document, or going into the options>trust center>trust center settings>trusted locations and adding the folder the back-end lives in.
Upvotes: 0
Reputation: 1776
In my case the issue was with a local Access Library reference (*.accda). No, it wasn't the usual problem of the reference not found. I had the referenced library in the same folder as the primary database, so it pulled in the relative path as it should. Iterating through the project references and examining the FullPath
didn't uncover the error either, since the path was correct there.
What I found was that I had to actually remove the reference, and add it back to the database (using the same path) for it to fully update the internal paths for the reference. This can be done programmatically, so it wasn't a big deal. I have set up some code to do this on first run after an update, and all is well again.
If you are using the following code sample, you will need to define a function (AppVersion
) to handle the current development version of your database. In my case, I used a custom property in the current database to hold this value.
Option Compare Database
Option Explicit
Option Private Module
'---------------------------------------------------------------------------------------
' Procedure : UpdateReferences
' Author : Adam Waller
' Date : 1/30/2017
' Purpose : Update application references to latest versions.
'---------------------------------------------------------------------------------------
'
Public Sub UpdateReferences()
Const VB_PROJECT As Integer = 1
Dim ref As Reference
Dim intCnt As Integer
Dim strLatest As String
Dim strRelative As String
Dim blnFirstRun As Boolean
' Check if this is the first run since this version was
' installed. (If so, remove and add library databases
' to make sure they register properly. Otherwise you may
' encounter odd errors like 3044 even though the reference
' path is set correctly.)
blnFirstRun = (GetSetting(VBE.ActiveVBProject.Name, "Install", "Current Version") <> AppVersion)
If blnFirstRun Then Debug.Print "Updating references on first run..."
For intCnt = Application.References.Count To 1 Step -1
Set ref = Application.References(intCnt)
If ref.Kind = VB_PROJECT Then
strRelative = GetRelativePath(ref.FullPath)
If ref.FullPath <> strRelative Or blnFirstRun Then
' First run, or reference is not relative.
' Check to see if it exists locally.
If Dir(strRelative) <> "" Then
' Relative file found. Update to use this one instead.
Application.References.Remove ref
Set ref = Nothing
Set ref = Application.References.AddFromFile(strRelative)
Debug.Print "Updated " & ref.Name & " to relative path. (" & ref.FullPath & ")"
End If
End If
End If
Next intCnt
' Record current version after first run.
If blnFirstRun Then SaveSetting VBE.ActiveVBProject.Name, "Install", "Current Version", AppVersion
DoEvents
End Sub
'---------------------------------------------------------------------------------------
' Procedure : GetRelativePath
' Author : Adam Waller
' Date : 1/26/2017
' Purpose : Gets the relative path of the file.
'---------------------------------------------------------------------------------------
'
Private Function GetRelativePath(strPath As String) As String
Dim strFile As String
Dim intPos As Integer
intPos = InStr(1, StrReverse(strPath), "\")
If intPos > 0 Then
strFile = Mid(strPath, Len(strPath) - (intPos - 1))
GetRelativePath = CodeProject.Path & strFile
Else
GetRelativePath = strPath
End If
End Function
Upvotes: 0
Reputation: 7215
If the linked table manager is not working you could do it with code. Here is a quick function that will replace any linked tables with the new path
Public Function Relink_tables(strNew_file_path As String)
Dim tdf As DAO.TableDef
Dim db As DAO.Database
Set db = CurrentDb
For Each tdf In db.TableDefs
'check to see that it is a linked tables
If Len(tdf.Connect) > 0 Then
'table is linked, replace the path with the new one
tdf.Connect = ";DATABASE=" & strNew_file_path
End If
Next tdf
db.Close
Set db = Nothing
End Function
Upvotes: 0
Reputation: 48024
In the front end database, right click the table name (the one that has the little arrow on the top left) and choose "Linked Table Manager" from there.
The reason it is not available in your backend database is because there are no linked tables in that database.
When you open the front end and the form opens, the Navigation Pane is probably minimized on the left hand side. You can click that to get a list of objects.
To remove the startup form, with the Front End opened, go to the Menu
/ Access Options
/ Current Database
and change the startup form to none
. In the same menu, scroll down and you can set options to show/hide the navigation pane.
Upvotes: 3