F
Francois Houde
Hi everybody, I have a problem with the code below. It works fine when it is
in a accdb but when I create an ACCDE it doesn't work. Any idea on how to
solve this issue ? I'm trying to connect to a different sql database (test,
pre-production, production depending on which one the user want to access)
Thanks in advance
François Houde
Dim rVersion As String
Dim rConnect As String
Dim TableDef As Object
rVersion = WhichVersion()
Me.Caption = Trim(Me.Caption) & " (" & rVersion & ")"
If rVersion = "Pre-production" Then
rConnect = "ODBC;DSN=DSN_PreProd;Description=DSN_PreProd;APP=2007
Microsoft Office system;DATABASE=PreProd;Trusted_Connection=Yes"
End If
If rVersion = "Production" Then
rConnect =
"ODBC;DSN=DSN_Production;Description=DSN_Production;APP=2007 Microsoft Office
system;DATABASE=Production;Trusted_Connection=Yes"
End If
If rVersion = "Test" Then
rConnect = "ODBC;DSN=DSN_Test;Description=DSN_Test;APP=2007
Microsoft Office system;DATABASE=Test;Trusted_Connection=Yes"
End If
For Each TableDef In CurrentDb.TableDefs
If TableDef.Connect <> "" Then
TableDef.Connect = rConnect
TableDef.Refreshlink
End If
Next
in a accdb but when I create an ACCDE it doesn't work. Any idea on how to
solve this issue ? I'm trying to connect to a different sql database (test,
pre-production, production depending on which one the user want to access)
Thanks in advance
François Houde
Dim rVersion As String
Dim rConnect As String
Dim TableDef As Object
rVersion = WhichVersion()
Me.Caption = Trim(Me.Caption) & " (" & rVersion & ")"
If rVersion = "Pre-production" Then
rConnect = "ODBC;DSN=DSN_PreProd;Description=DSN_PreProd;APP=2007
Microsoft Office system;DATABASE=PreProd;Trusted_Connection=Yes"
End If
If rVersion = "Production" Then
rConnect =
"ODBC;DSN=DSN_Production;Description=DSN_Production;APP=2007 Microsoft Office
system;DATABASE=Production;Trusted_Connection=Yes"
End If
If rVersion = "Test" Then
rConnect = "ODBC;DSN=DSN_Test;Description=DSN_Test;APP=2007
Microsoft Office system;DATABASE=Test;Trusted_Connection=Yes"
End If
For Each TableDef In CurrentDb.TableDefs
If TableDef.Connect <> "" Then
TableDef.Connect = rConnect
TableDef.Refreshlink
End If
Next