Function GET_RID_OF_SQL_LOGON_BOX()
On Error GoTo Err_btn_Update_SQL_LINKHIST_Click
Dim dbsCurrent As Database
Dim tdfLinked As TableDef
Dim strConnection As String
Dim strSourceDBConnectionLine As String
Dim ArrayLength As Long
Dim ArrayIndex As Long
Dim strErrMsg As String
Dim FlagErrMsg As Boolean
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentData
FlagErrMsg = False
strErrMsg = " You Have Errors: " & Chr(13) & Chr(10)
' Open a database to which a linked table can be
' appended.
Set dbsCurrent = CurrentDb
strSourceDBConnectionLine = "ODBC;DATABASE=PDS_DATA_PROD_VER5;UID=sa;PWD=pds2005;DSN=PDS_DEV_LOCAL_05"
Dim tempName As String
' Search for open AccessObject objects in AllTables collection.
For Each obj In dbs.AllTables
tempName = obj.NAME
If tempName = "accounts" Then
' Print name of obj.
dbsCurrent.TableDefs.Delete tempName
Set tdfLinked = _
dbsCurrent.CreateTableDef(obj.NAME, , obj.NAME)
tdfLinked.connect = strSourceDBConnectionLine
tdfLinked.SourceTableName = obj.NAME
dbsCurrent.TableDefs.Append tdfLinked
'ArrayIndex = ArrayIndex + 1
End If
Next obj
dbsCurrent.Close
Set dbsCurrent = Nothing
' MsgBox ("Connection to AIMS History Data HAS Been Successfully Refreshed")
Exit_btn_Update_SQL_LINKHIST_Click::
Exit Function
Err_btn_Update_SQL_LINKHIST_Click:
MsgBox err.DESCRIPTION
Resume Exit_btn_Update_SQL_LINKHIST_Click:
End Function