Sub basChangeConnect (argSession As String) ' 'NOTE: This procedure contains line break characters 'for readability. These characters are not supported 'in Access Basic. ' Set m_dbDAO = DBEngine(0)(0)
Select Case argSession
Case "Production"
For m_intObj = 1 To m_dbDAO.TableDefs.Count - 1
If m_dbDAO.TableDefs(m_intObj).Connect _
Like "ODBC*" Then
m_dbDAO.TableDefs(m_intObj).Connect _
= ODBC_TBLCONNECT_STRING_PROD
m_dbDAO.TableDefs(m_intObj).RefreshLink
End If
Next m_intObj
For m_intObj = 1 To m_dbDAO.QueryDefs.Count - 1
If m_dbDAO.QueryDefs(m_intObj).Connect _
Like "ODBC*" Then
m_dbDAO.QueryDefs(m_intObj).Connect _
= ODBC_QRYCONNECT_STRING_PROD
m_dbDAO.QueryDefs.Refresh
End If
Next m_intObj
Case "Test"
For m_intObj = 1 To m_dbDAO.TableDefs.Count - 1
If m_dbDAO.TableDefs(m_intObj).Connect _
Like "ODBC*" Then
m_dbDAO.TableDefs(m_intObj).Connect _
= ODBC_TBLCONNECT_STRING_TEST
m_dbDAO.TableDefs(m_intObj).RefreshLink
End If
Next m_intObj
For m_intObj = 1 To m_dbDAO.QueryDefs.Count - 1
If m_dbDAO.QueryDefs(m_intObj).Connect _
Like "ODBC*" Then
m_dbDAO.QueryDefs(m_intObj).Connect_
= ODBC_QRYCONNECT_STRING_TEST
m_dbDAO.QueryDefs.Refresh
End If
Next m_intObj
End Select
End Sub