P. Teguh JAP

Anda coba deh script dibawah ini:

Dim W As Workspace
Dim db As Database
Dim td As TableDef
Dim lokasiDB As String
 
lokasiDB = Application.CurrentProject.Path & "\DB.mdb"

 Set W = DBEngine.Workspaces(0)
 Set db = W.OpenDatabase(lokasiDB)

For Each td In db.TableDefs
DoCmd.TransferDatabase acLink, "Microsoft Access", lokasiDB, acTable, td.Name, 
td.Name
Next 
Set db = Nothing
Set W = Nothing


Mudah2an bisa membantu

Salam,
Nino



  ----- Original Message ----- 
  From: Teguh JAP 
  To: [email protected] 
  Sent: Tuesday, February 03, 2009 8:40 AM
  Subject: Re: [belajar-access] Link Tabel pada Path yg sama


  Pak Nino (Che) G.R

  Untuk syntax " lokasidb " sudah saya koreksi beberapa kali.
  1. CurrentProject.Path + "DB.mdb"
  2. CurrentProject.Path + "\DB.mdb"
  4. CurrentProject.Path & "DB.mdb"
  5. CurrentProject.Path & "\DB.mdb"

  tapi muncul error lagi ketika proses " td.RefreshLink " .
  Pesan Errornya seperti ini " Could Not Find Installable ISAM " :((

  2009/2/2, Nino Guevara Ruwano <[email protected]>:
  > Pak Teguh
  >
  > Kayaknya sih masalah sintaks aja, coba anda ganti:
  > lokasidb = Me.Path + "DB.mdb"
  > dengan
  > lokasidb = CurrentProject.Path + "DB.mdb"
  > atau
  > lokasidb = CurrentProject.Path & "DB.mdb"
  >
  > Mudah2an bisa membantu
  >
  > Salam,
  > Nino
  >
  >
  >
  >
  > ----- Original Message -----
  > From: Teguh JAP
  > To: belajar-access
  > Sent: Monday, February 02, 2009 5:19 PM
  > Subject: [belajar-access] Link Tabel pada Path yg sama
  >
  >
  > Salam Semua..
  > Buat Abang2 yg baik
  >
  > Saya ada kesulitan untuk melakukan Link / Relink tabel ke DB lain tapi
  > dalam satu path.
  > Saya punya folder mis folder "Program" saya taruh di C:\
  > Dalam folder tsb berisi DB.mdb dan Program.mde (program.mde link tabel
  > dari DB.mdb)
  >
  > Bagaimana cara agar folder beserta file - file yg ada didalamnya
  > ketika saya pindahkan ke direktory lain (D:\ ) atau folder lain tapi
  > link tabel tetap berfungsi tanpa perlu melakukan proses Relinking...
  >
  > saya sudah coba kode ini, tapi tidak berhasil :
  >
  > Dim td As DAO.TableDef
  > Dim db As DAO.Database
  > Dim lokasidb As String
  > lokasidb = Me.Path + "DB.mdb"
  >
  > On Error GoTo errHandle
  >
  > Set td = New DAO.TableDef
  > Set db = CurrentDb
  >
  > For Each td In db.TableDefs
  > If Left(td.Name, 4) <> "MSys" Then
  > td.Connect = lokasidb
  > td.RefreshLink
  > End If
  > Next td
  >
  > MsgBox "All table has reconected to current server.", vbInformation
  > Set td = Nothing
  > Set db = Nothing
  >
  > UpdateLinkTable = True
  > Exit Sub
  >
  > errHandle:
  > MsgBox Err.Description & vbCrLf & "Reconnection failed to server !!!!"
  > Set td = Nothing
  > Set db = Nothing
  >
  > terima kasih
  >
  >
  >
  >


   

Kirim email ke