Hi. I'm trying to automate the updating of linked tables in a database in case of moving the main DB.
For the .xlsx files, the code works.
For the .csv files, the code give me error "3044 - 'C:\correctpath\Invoice_New.csv' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server onto which the file resides.
The path is correct....and for the .xlsx it work....someone can help to fix it ?
Thanks & sorry for the bad english
	
	
	
		
 For the .xlsx files, the code works.
For the .csv files, the code give me error "3044 - 'C:\correctpath\Invoice_New.csv' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server onto which the file resides.
The path is correct....and for the .xlsx it work....someone can help to fix it ?
Thanks & sorry for the bad english
		Code:
	
	
	Dim Cpath As String
    Cpath = CurrentProject.Path
  
    Dim File
    Set oFSO1 = CreateObject("Scripting.FileSystemObject")
    File = Cpath & "\utility\Path.txt"
    Set oTXT = oFSO1.OpenTextFile(File, 1, True)
    Line = oTXT.ReadLine
  
    If Line <> Cpath Then
        Dim tdf As DAO.TableDef
        Dim Db As DAO.Database
        
        Set Db = CurrentDb()
        
        Set tdf = Db.TableDefs("DayMonth")
        tdf.Connect = "Excel 12.0 Xml;HDR=NO;IMEX=2;ACCDB=YES;DATABASE=" & Cpath & "\utility\DayMonth.xlsx"
        tdf.RefreshLink
        
        Set tdf = Db.TableDefs("Racc_Rating_Text")
        tdf.Connect = "Excel 12.0 Xml;HDR=NO;IMEX=2;ACCDB=YES;DATABASE=" & percorso & "\utility\Racc Rating text.xlsx"
        tdf.RefreshLink
        
        Set tdf = Db.TableDefs("Invoice_New")
        tdf.Connect = "Text;HDR=YES;FMT=TabDelimited;DATABASE=" & percorso & "\input\Invoice_New.csv"
        tdf.RefreshLink