Split database: Back end file path (via vba)

itazev

Registered User.
Local time
Today, 07:39
Joined
Jan 28, 2007
Messages
18
Hey guys,

How can I change the tables' splitted file path via vba?

Ex.: c:\tables.mdb -> c:\new path\tables.mdb

thank you.
 
Look Up the tabledef object in VBA Help! Specifcally the RefreshLink method.


Dim myDef as tabledef

set mydef=currentdb.tabledefs([Table Name])
mydef.refreshlink
 
Hey!

I found this code on the help but i don't know hot to adapt it properly

Code:
Sub ClientServerX1()

   Dim dbsCurrent As Database
   Dim qdfPassThrough As QueryDef
   Dim qdfLocal As QueryDef
   Dim rstTopFive As Recordset
   Dim strMessage As String

   ' Open a database from which QueryDef objects can be 
   ' created.
   Set dbsCurrent = OpenDatabase("DB1.mdb")

   ' Create a pass-through query to retrieve data from
   ' a Microsoft SQL Server database.
   Set qdfPassThrough = _
      dbsCurrent.CreateQueryDef("AllTitles")
   ' Note: The DSN referenced below must be set to 
   '       use Microsoft Windows NT Authentication Mode to 
   '       authorize user access to the Microsoft SQL Server.
   qdfPassThrough.Connect = _
       "ODBC;DATABASE=pubs;DSN=Publishers"
   qdfPassThrough.SQL = "SELECT * FROM titles " & _
      "ORDER BY ytd_sales DESC"
   qdfPassThrough.ReturnsRecords = True

   ' Create a temporary QueryDef object to retrieve
   ' data from the pass-through query.
   Set qdfLocal = dbsCurrent.CreateQueryDef("")
   qdfLocal.SQL = "SELECT TOP 5 title FROM AllTitles"

   Set rstTopFive = qdfLocal.OpenRecordset()

   ' Display results of queries.
   With rstTopFive
      strMessage = _
         "Our top 5 best-selling books are:" & vbCr

      Do While Not .EOF
         strMessage = strMessage & "  " & !Title & _
            vbCr
         .MoveNext
      Loop

      If .RecordCount > 5 Then
         strMessage = strMessage & _
            "(There was a tie, resulting in " & _
            vbCr & .RecordCount & _
            " books in the list.)"
      End If

      MsgBox strMessage
      .Close
   End With

   ' Delete new pass-through query because this is a
   ' demonstration.
   dbsCurrent.QueryDefs.Delete "AllTitles"
   dbsCurrent.Close

End Sub

I split the database and now I need to re-link the table references to... lets say "c:\my_tables.mdb"

This code seems to show only a temporary connect for a sql query.

I appreciate any help!
 

Users who are viewing this thread

Back
Top Bottom