(1) How can I check to see if the linked tables are working correctly when the database is opened?
(2) If there is a problem with the linked tables then I would like to delete and recreate the linked table.
(3) Is there a better way to make sure the linked tables are always working then the one I have come up with? Any help would be appreciated. (I already have a way to for the user to open a dialog box and point the database that has the tables. What I am trying to due is hardcode the linked table if they cannot be opened to a default setting that should work.)
Thank You
rjoshi2
Here is my code for part 2 of my question:
Function hardCoded()
Dim deleted As String
Dim todayDate As Date
Dim currentDay As Integer
'Get system's date
' todayDate = Date
' Extracting Day from todayDate
' currentDay = Day(todayDate)
DoCmd.SetWarnings False
'If currentDay = 9 Or currentDay = 18 Or currentDay = 27 Then
'hard coded table links
'If the directory is change where the data file is kept
'Then the path has to be change to reflect the new location
deleted = "DROP TABLE [Core Data Dump]"
DoCmd.RunSQL deleted
DoCmd.TransferDatabase acLink, "Microsoft Access", "\\Psc2\Data\Ocio\SHARED\Acquisitions\Back end of PSC IT Acquisition Log\PSC IT Acquisition Data File.mdb" _
, acTable, "Core Data Dump", "Core Data Dump"
deleted = "DROP TABLE [PSC IT Acquisition Log]"
DoCmd.RunSQL deleted
DoCmd.TransferDatabase acLink, "Microsoft Access", "\\Psc2\Data\Ocio\SHARED\Acquisitions\Back end of PSC IT Acquisition Log\PSC IT Acquisition Data File.mdb" _
, acTable, "PSC IT Acquisition Log", "PSC IT Acquisition Log"
deleted = "DROP TABLE [tblObjClsDesc]"
DoCmd.RunSQL deleted
DoCmd.TransferDatabase acLink, "Microsoft Access", "\\Psc2\Data\Ocio\SHARED\Acquisitions\Back end of PSC IT Acquisition Log\PSC IT Acquisition Data File.mdb" _
, acTable, "tblObjClsDesc", "tblObjClsDesc"
deleted = "DROP TABLE [tblObjects]"
DoCmd.RunSQL deleted
DoCmd.TransferDatabase acLink, "Microsoft Access", "\\Psc2\Data\Ocio\SHARED\Acquisitions\Back end of PSC IT Acquisition Log\PSC IT Acquisition Data File.mdb" _
, acTable, "tblObjects", "tblObjects"
deleted = "DROP TABLE [tblObjectsInSystem]"
DoCmd.RunSQL deleted
DoCmd.TransferDatabase acLink, "Microsoft Access", "\\Psc2\Data\Ocio\SHARED\Acquisitions\Back end of PSC IT Acquisition Log\PSC IT Acquisition Data File.mdb" _
, acTable, "tblObjectsInSystem", "tblObjectsInSystem"
DoCmd.SetWarnings True
'End If
End Function
(2) If there is a problem with the linked tables then I would like to delete and recreate the linked table.
(3) Is there a better way to make sure the linked tables are always working then the one I have come up with? Any help would be appreciated. (I already have a way to for the user to open a dialog box and point the database that has the tables. What I am trying to due is hardcode the linked table if they cannot be opened to a default setting that should work.)
Thank You
rjoshi2
Here is my code for part 2 of my question:
Function hardCoded()
Dim deleted As String
Dim todayDate As Date
Dim currentDay As Integer
'Get system's date
' todayDate = Date
' Extracting Day from todayDate
' currentDay = Day(todayDate)
DoCmd.SetWarnings False
'If currentDay = 9 Or currentDay = 18 Or currentDay = 27 Then
'hard coded table links
'If the directory is change where the data file is kept
'Then the path has to be change to reflect the new location
deleted = "DROP TABLE [Core Data Dump]"
DoCmd.RunSQL deleted
DoCmd.TransferDatabase acLink, "Microsoft Access", "\\Psc2\Data\Ocio\SHARED\Acquisitions\Back end of PSC IT Acquisition Log\PSC IT Acquisition Data File.mdb" _
, acTable, "Core Data Dump", "Core Data Dump"
deleted = "DROP TABLE [PSC IT Acquisition Log]"
DoCmd.RunSQL deleted
DoCmd.TransferDatabase acLink, "Microsoft Access", "\\Psc2\Data\Ocio\SHARED\Acquisitions\Back end of PSC IT Acquisition Log\PSC IT Acquisition Data File.mdb" _
, acTable, "PSC IT Acquisition Log", "PSC IT Acquisition Log"
deleted = "DROP TABLE [tblObjClsDesc]"
DoCmd.RunSQL deleted
DoCmd.TransferDatabase acLink, "Microsoft Access", "\\Psc2\Data\Ocio\SHARED\Acquisitions\Back end of PSC IT Acquisition Log\PSC IT Acquisition Data File.mdb" _
, acTable, "tblObjClsDesc", "tblObjClsDesc"
deleted = "DROP TABLE [tblObjects]"
DoCmd.RunSQL deleted
DoCmd.TransferDatabase acLink, "Microsoft Access", "\\Psc2\Data\Ocio\SHARED\Acquisitions\Back end of PSC IT Acquisition Log\PSC IT Acquisition Data File.mdb" _
, acTable, "tblObjects", "tblObjects"
deleted = "DROP TABLE [tblObjectsInSystem]"
DoCmd.RunSQL deleted
DoCmd.TransferDatabase acLink, "Microsoft Access", "\\Psc2\Data\Ocio\SHARED\Acquisitions\Back end of PSC IT Acquisition Log\PSC IT Acquisition Data File.mdb" _
, acTable, "tblObjectsInSystem", "tblObjectsInSystem"
DoCmd.SetWarnings True
'End If
End Function